If the Player gives a wrong answer, the scene should be shown until it gets a touch so the actual scene can be reloaded and played again by the player.
void Update()
{
if (right answer)
{
do something
}
else
{
StartCoroutine(waitForInput());
}
}
private IEnumerator waitForInput()
{
while (!Input.GetMouseButtonDown(0))
{
Debug.Log("wait for input");
yield return null;
}
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
The problem right here is, that if the player gives an wrong answer the actual scene is reloading without waiting for an input. So basically the while loop is not working and i don’t know why. Does anybody have an idea?