I want my character to go to the Move state whenever Speed is larger than 0, from any state. Setting a transition from Any State to the Move State with the Speed > 0 condition, makes the Move animation restart again and again.
What happens is that you tell the system that in “Any state” that you are in, when Speed > x, transition to Move. So even when you are in Move, the transition is called !
A way to prevent this, would be to add a bool Parameter called InMove and add the condition “InMove is false” to your AnyState Transition. You set the bool to true when you enter the InMove state.
We have internally discussed to prevent AnyState transition re-entering the same state but decided to allow it, since it can be usefull in some instance!
I would also suggest using sub-stateMachines. We made numerous workflow fixes in the next version, that will make it super easy to drop states in and out of stateMachines. Should make the graph less spagethi-like!
So guys, finally we have users that already rely on AnyState to transition states to self.
So the fix won’t be in 4.1. We started designing a system when we could reset some values to default when some transitions are taken. It won’t be in 4.1 however.
Unitl then, I would simply suggest that you give a name to your transition, and then in code do something like :
Only one time it runs right, when i set bool Parameter “inMove” to true, but I can’t get when it’s transition “Any State” to set inMove to false :(.
Thank you.
While the trigger parameters clear up the vast majority of the issues, I still feel that the system needs to change so states cannot transition into themselves. It’s a very strange ‘feature’, and I have to work around it far more often than I get to take advantage of it.
From the sound of it, you understand that it behaves in a strange way and would like to change it, but are worried that changing it now will corrupt any projects that rely on it. What if you made it an option on every state (should the state be reentrant or not) that defaults to false on newly created states, but is set to true on all pre-existing states when the project is converted?