- Home /
How can create touch restart button below code?
Could anyone support me?in below code,if statements doesnot works,could you find reason?
function OnGUI(){
if(Input.touchCount>0){
if (GUI.Button(Rect(Screen.width/1.12, 0, Screen.width/8, Screen.height/8),"restart")){
Application.LoadLevel(1);
}
}
}
Comment
the GUI.Button itself is reacting to touch all by itself. Remove the first if.