Hello to everyone. With the following code I’m trying to disable a GUI, waiting for a touch to re-enable it inside a coroutine. It doesn’t work but i can’t figure out why.
IEnumerator DisplayConversation(Conversation c)
{
inputManager.SendMessage("DisableInput");
conversating = true;
foreach (ConversationEntry line in c.conversationLines)
{
//doStuff
yield return StartCoroutine(WaitForTouch());
}
conversating = false;
inputManager.SendMessage("EnableInput");
yield return null;
}
IEnumerator WaitForTouch()
{
Input.multiTouchEnabled = false;
//Check: it doesn't work!
while (Input.touchCount == 0 || Input.GetTouch(0).phase != TouchPhase.Began )
{
Debug.Log("Touch count: " + Input.touchCount.ToString() +" Touch phase: " + Input.GetTouch(0).phase.ToString());
yield return null;
}
Input.multiTouchEnabled = true;
yield return null;
}
Any help would be appreciated. Thanks in advance.