SetTrigger not working

Hello!

I have written a small script to change the state of an animator upon the input of any button, but nothing happens and there are no errors.

var anim : Animator;
var TheAnim : String;

function Start () 
{
    anim = GetComponent("Animator");
}


function Update () 
{
    if(Input.anyKey)
    {
        anim.SetTrigger (TheAnim);
    }
}

Any help would be appreciated, Thank you!

Hi, be sure that you have a Trigger Parameter and that you assigned it to your Transition under conditions…

On the right Side, under Conditions you can choose which Parameter you want to use.

hope this helps!

the name of the trigger needs to be in quotes:
anim.SetTrigger(“TheAnim”);