WaitForSeconds Not working.
Okay So I have a simple game and a method that looks like this :
public IEnumerator Wait()
{
yield return new WaitForSeconds(10);
}
and then it's called here:
void OnTriggerEnter(Collider other) {
if (other.gameObject.CompareTag ("death")) {
ingame = false;
Wait();
player.transform.position = (new Vector3(0,0,-48.56179f));
}
BUT When the collision happens, the player instantly moves, and no waiting happens. Why is this?
Been driving me crazy for 2 days now - I've tried other methods of waiting like invoke or having a time variable, but none of these work - they either wait for no time or freeze unity. AHHHHHHHGH!
Answer by wolfgang7913 · Oct 30, 2017 at 10:52 PM
EDIT: I also tried calling the wait function in fixed update, and no results.
Your answer
Follow this Question
Related Questions
I cant get the basic FollowPlayer script to go to Main Camera in the hierarchy 0 Answers
I want to exactly put my player where i want it be. 0 Answers
Cant get rid of old unity version 2018.4.22 0 Answers
Could Not Find Importer After Update 0 Answers
Vertical Layout Group not Updating Child Positions? 0 Answers