UNITY3D 如何添加两个按钮?下面是一个按钮的代码,如何在其下方再添加一个按钮?求高手解救。初学UNITY!

2025-04-18 04:03:50
推荐回答(2个)
回答1:

var customSkin:GUISkin;
function OnGUI () {
if(GUI.Button(Rect(Screen.width/2-50, Screen.height/2+200, 100,50), "Play game"))
{
print("You clicked me");
Application.LoadLevel(1);
}
//GUI.Button(Rect(Screen.width/2-50, Screen.height/2+260, 100,50), "exit game");
if(GUI.Button(Rect(Screen.width/2-50, Screen.height/2+260, 100,50), "exit game"))
{
print("You clicked me");
Application.LoadLevel(2);
}

}
}

回答2:

学着习中