- Home /
Mecanim new Trigger parameter explanation?
Hi,
Does anyone knows how the new Trigger parameter on Mecanim is intended to be used? What's its difference between a Boolean parameter? Has the name of the trigger parameter to be related with something else? like a gameobject that you collide or something? Its somehow related with events new feature?
Sorry for the vague-open question but its as vague and open as Unity "explanation" of that new feature. :(
Thats the only thing I have found on the net "Trigger parameter, a trigger is a boolean parameter that is reset by the controller when consumed by a transition."
Any example on how to use it?
Cheers!
It's just like a normal parameter with the only distinction being that it automatically switches off when the animation starts.
Answer by lxem · Dec 12, 2013 at 03:30 PM
Use trigger like this:
void Update ()
{
if (foo > 1.0f)
{
Animator animator = GetComponent<Animator>() as Animator;
animator.SetTrigger("Attack2Trigger");
}
}
Trigger is used only once so that you don't have to maintain it.
Your answer
Follow this Question
Related Questions
Mechanim Trigger Issue 1 Answer
Use Mecanim Transition as Trigger 0 Answers
Animation will not Return to Proper State 2 Answers
Transition not keeping value after Play (bug?) 1 Answer
Totally new noob to mecanim and unity itself - Trigger animation? 0 Answers