Trying to play animations after each other in a for loop

So I have an array with animations called ani and I’m trying to start the after eachother with this:

	public Animation[] ani;

	void Start () 
	{

		ani = new Animation[4];
		ani = bushesParent.GetComponentsInChildren<Animation>();

	}

	void Update () 
	{	
	for(int i =0; i < ani.Length; i++)
	{
	ani*.Play();*
  • StartCoroutine(wait(ani.Length));*

  • }*

  • }*

  • IEnumerator wait(float waitTime)*

  • {*

  •  yield return new WaitForSeconds(waitTime);*
    
  • }*
    }

Thnx in advance!

I would put the whole thing into its own Coroutine. So you’d get :

IEnumerator PlayAnimations(){
     for (int i = 0; i < ani.Length; i ++){
          ani*.Play();*

yield return new WaitForSeconds(ani*.clip.length);*
}
}
Then just call the function from Start() or elsewhere, just not in an Update() as that would call it every frame.
For example:
Void Start(){
//You’ve made your ani Array here. Then:
StartCoroutine(PlayAnimations());
}

IEnumerator Wait()
{
for(int i = 0; i < ani.Length; i++)
{
ani*.Play();*
yield return new WaitForSeconds(ani*.clip.length);*
}
}