How to play an animation when a trigger is active?

I am not using a blend tree because it doesn’t allow me to use a bool / trigger. I just need to play the animation when the trigger is active and enabled.

If you are doing it fully from script, add this:

 if(trigger){
    GetComponent<Animator>().Play("myAnim");
     }

Or a simpler way is to get a reference to your animator. Then:Animator.SetTrigger("trigger");