Trying to sequence my animator with Coroutine.

Hi all,
I’m trying to get my animation to be in sequence so i’ve added a Coroutine (time delay) but it hasn’t worked and i’m unsure what i’ve done wrong?
Any help would be appreciated.
thanks

if (Input.GetAxisRaw (“Fire1”) > 0)

	{
		myAnim.SetTrigger("shooting"); 
		StartCoroutine ("waitThreeSeconds"); 
		fireRocket() ;	 

	}
		
}

IEnumerator waitThreeSeconds()
{
	yield return new WaitForSeconds (5); 
}

If you want to run methods in sequence rather than in parallel, then those methods need to be in a coroutine, and you need to “yield” for each one before you call the next one. Also, defining a new Wait() coroutine is redundant since WaitForSeconds() will do the job.

if (Input.GetAxisRaw ("Fire1") > 0)
{
    StartCoroutine(_FireSequence());
}

IEnumerator _FireSequence()
{
    myAnim.SetTrigger("shooting");
    yield return new WaitForSeconds(5); //note the use of yield
    fireRocket();   
}

{
myAnim.SetTrigger(“shooting”);
StartCoroutine (Wait(5));
fireRocket();
}
}
IEnumerator Wait(int seconds)
{
yield return new WaitForSeconds (seconds);
}
Should work.