- Home /
Enable/Disable Touch during runtime.
Good day All, I am having problems enabling/disabling touch during runtime. What I need is a code to quickly disable the main touch and then enable it again for play. As it stands the code works perfectly if I comment out the if(transitionwait) however the minute I include it and disable it when it gets triggered again it refuses to correctly trigger Button1 correctly. currently my code is as follows.
if(transitionwait) { foreach (Touch t in Input.touches) { Vector2 vec = t.position; vec.y = Screen.height - vec.y; //inverted GUI and screen have different coordinate system.
if (Button1.Contains (vec))
{
insidebutton (1);
}
}
where I am setting transitionwait as follows.
.... transitionwait = false; StartCoroutine(Waiting()); ....
IEnumerator Waiting(); { yield return new WaitForSeconds(0.1f); transitionwait = true;
}
I have no errors for compiling so any spelling errors were created from me retyping.
Thanks all!
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Script Efficiency 1 Answer
(C#) Public variables that have descriptions in the engine. 2 Answers
How would i slow a car down when it hit off road on a track 3 Answers