Make Animation Play After Boolean is Set to True?

Hello all,

I am pretty fluent in using Unity, but regarding Mechanim and Animations I am not the too great at currently, so please don’t give me too much of a hard time lol.
So I have this boolean that is in my GameManager script :

 public bool countDownDone = false;

This boolean gets set to true once my “3,2,1, GO!” Countdown Timer ends at the beginning of my game. Everything in my game starts after that boolean is set to true.

using UnityEngine;
   using System.Collections;

   public class PlaneMover : MonoBehaviour {

private GameManagerScript GMS; // Reference to my GameManager Script

public float scrollSpeed;
public float tileSizeZAxis;
public float acceleration; //This has to be a negative number in the inspector. Since our plane is coming down.

private Vector3 startPosition;

void Start () {

	GMS = GameObject.Find ("GameManager").GetComponent<GameManagerScript> (); //Finds the Script at the first frame

	// Transform position of the quad
	startPosition = transform.position;

void Update () {
	if (GMS.countDownDone == true) //Everything starts once the countdown ends. 

		/* Every frame - time in the game times the assigned scroll speed 
			and never exceed the length of the tile that we assign */
		float newPosition = Mathf.Repeat (Time.time * scrollSpeed, tileSizeZAxis);

		// New position equal to the start position plus vector3forward times new position
		transform.position = startPosition + Vector3.forward * newPosition; // was vector3.forward

		scrollSpeed += Time.deltaTime * acceleration; // This makes the plane increase in speed over 
											          //  time with whatever our acceleration is set to.


I have this Crawling animation that plays at the very beginning of the game (Even before the Timer ends) and loops forever. My question is , how do I make that crawling animation also start once that boolean is set to “true”? Or do I just apply it to a CoRoutine and make it play after 3 seconds? I have done extensive research on whether to reference Animation or Animator and I got confused on that too. Any advice?
If you need more pictures or details on my question, just let me know. Thank you! :slight_smile:

@stephen_george98 If there is only one state or even if you have more states this is the way you should delay the animations. You should deactivate the “Animator” component in inspector by default, then after the countdown ends activate the “Animator” component like this:

public Animator animator;

void StartAnimations()
    animator.enabled = true;

Pass animator reference in variable “animator” and call “StartAnimations()” function when countdown is completed.

Well you haven’t posted a pic of your animation controller. But in there, you have to make a transition from an “idle” animation to your desired one. Then you need a Boolean parameter there which you can set in your code true when ever you need it.

Sorry if I’m not clear, ask my if you don’t get it

Read more here: