c# – Getting the id/name of the state triggered by a boolean parameter in Unity animator controller

Here’s the situation: in my project, parameters (triggers) across all objects have the same name, unlike the states, that can vary from object to object for reasons beyond my control, for the lack of better explanation.

So I can easily get the name of the parameter by calling

obj.animator.GetBool("Attack Ranged")

to get the moment it is activated. What I need is to get the state it triggers (“Range attack” in this specific case). Why I need it is to wait while it is playing to pause other functions.

So how do I get it? Again, I only know the name of the parameter and that it triggers a particular state.

I’m happy with either the id or the name of the state as long as I can get it via its trigger.

Read more here: Source link