Answer the question
In order to leave comments, you need to log in
Unity (C#) - How to read a finger touch on a button?
How to count finger touch on a button (GUI)? Here is the code:
void OnGUI () {
GUI.Box(new Rect(550,572,400, 30), "");
GUI.Label (new Rect(560,577,340,20), Message1);
if(GUI.Button(new Rect(900,572,50,30), "ОК")) {
gameObject.SetActive (false);
Object.SetActive (false);
}
}
Answer the question
In order to leave comments, you need to log in
First, why are you using OnGUI? This is an ancient interface system that is now only used for debug buttons. Everyone has long switched to a new UI or plugins.
Secondly, finger taps on mobile phones for OnGUI should work exactly the same as in the editor, maybe your buttons are small and therefore the taps do not work?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question