Mecanim / Animator : how to check if a Trigger is true ?

hello

I use some parameters in my Animator, multiple bools and also a couple of triggers.

When a Trigger parameter is turned on by calling SetTrigger() it stays true until it is used in a transition and it turns false after that. I really need that behavior, so I don’t want to use bools instead.

I need to know at some point if a trigger is true. I mean that it has been turned on, but the transition has not been played yet and it is still waiting for it.

There are the Animator.GetBool, GetInt & GetFloat functions, but not a GetTrigger function.

I tried the GetBool function with my trigger parameter’s name, but it always returns false …

How can I check if a Trigger has been set to true ?

Thanks in advance

Vince

It is very simple (If you haven’t already figured it out):

Animator animator = GetComponent<Animator>();
bool triggerValue = animator.GetBool("TriggerName");

A Trigger is just a Bool that is consumed (turned to false) once used, so it can be accessed the same exact way :slight_smile:

Are you checking the Animator window? You can have a first feedback of the triggers value there:

In Unity → Window → Animator

Hope it helps

yes i see that it turns on, but I want to get that value in C#