In this code, I’m calling the Move function, when I click on a button from the Unity. My problem is that if I tap (on android device or apple devices) or click (on windows) continuosly for two times, say suppose I tap on the button for two times repeatedly, then the function gets called two times at the same instant. I want to call the function only once even if many times, the button is clicked simultaneously. How do I detect that in Unity? I have tried several codes like:
Debug.Log(Input.touchCount);
But it is giving log value as 0 all the times. I need my function to be called only once at a time. Because in the MovePanelFromScreen(); function and MovePanelToScreen(); function, I’m using various iTween tweening for several buttons and its becoming messy all the times. So if I click on the button twice or thrice etc, only once Move function should be executed. If I’m able to detect touch count or tap count, then it would be easy for me. Thanks in advance.
function Move()
{
if(Index==1)
{
//MovePanelFromScreen();
Debug.Log("Next Menu");
Index=2;
}
else if(Index==2)
{
//MovePanelToScreen();
Debug.Log("Previous Menu");
Index=1;
}
}