- Home /
Question by
stenclowskimat · Nov 28, 2017 at 10:11 PM ·
animatoranimator controller
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!
Comment
Answer by dan_wipf · Nov 29, 2017 at 12:00 AM
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!
maketransition.jpg
(177.1 kB)
settrigger.jpg
(173.7 kB)
Answer by cesullivan · Dec 06, 2017 at 12:36 AM
the name of the trigger needs to be in quotes: anim.SetTrigger("TheAnim");