Boollean problem, animation trigger

Hi,

I believe this is simple, but I can’t get it to work right.

I just want to create a bool where one animation will play only after another has finished playing completely.

If anyone can help that would be great.

using UnityEngine;
using System.Collections;

public class BoolScript : MonoBehaviour {

    public GameObject Bump;
    public GameObject Dawk;
    public bool AnimationPlayed = false;
    
    // Use this for initialization
    void Start () {
      

        Dawk.GetComponent<Animation>().Play("Roll");
        AnimationPlayed = true;
    }
   
    // Update is called once per frame
    void Update () {

        if (AnimationPlayed = true) {
            Bump.GetComponent<Animation>().Play("Jump");
        }
      

       
    }
}

Maybe soemthing like

void Update() {
   if( Dawk.GetComponent<Animation>().time >= Dawk.GetComponent<Animation>().length ) {
      Dawk.GetComponent<Animation>().Stop();
      AnimationPlayed = true;
       Bump.GetComponent<Animation>().Play("Jump");
   }
}
1 Like

Thanks I’ll give this a try tomorrow. Thanks for your help.