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)
}
}
}
在你的脚本里面写上void OnGUI(){
if(GUI.Button(new Rect(0,0,100,30),"hello")){
print("这里写事件")
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)