Search Issue Tracker
Fixed in 5.6.0
[Mecanim] [Animation] When an interrupted transition occurs the OnStateExit for the next state currently playing is never called
We have a transition from state A to state B, with a reasonably long transition time (probably about 0.5s), and it allows interruptions (Interruption Source: Current State then Next State). There is an Any State transition to state C, with a trigger condition on it. State B has a State Machine Behaviour script attached to it.
If the condition for the transition from A to B is met, we begin transitioning from A to B, and we get B.OnStateEnter() being called. If the trigger condition for the Any State transition to state C becomes true before we have completed the transition to B, however, we transition to state C without seeing B.OnStateExit().
This resulted in things that we set up in OnStateEnter not being properly reset/cleared in OnStateExit.
1: Open attached project
2: Enter play mode for Main scene
3: Inspect Animator attached to Test GameObject
4: Activate the GoAToB Trigger to start a 10 second transition from A to B, see OnStateEntry is called for B (printed to console)
5: Activate GoC Trigger (during the transition from A to B, to interrupt it) to do the Any State to C transition
6: OnStateExit is called for A but not for B (see console)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- NullReferenceExceptions are being thrown when saving a ScriptableObject with an array of a type with a CustomPropertyDrawer that uses TrackPropertyValue
- Applied velocity is inconsistent when using Rigidbody AddForce() with ForceMode.VelocityChange
- Crash on AudioUtil_CUSTOM_HasAudioCallback when exiting Play Mode while the Inspector is displaying a GameObject with an empty script attached
- Scroll offset is framerate-dependent when scrolling with velocity in the Device Simulator
- "Object.FindObjectsOfType<T>() is obsolete" warning is thrown when using "Transitions Plus" asset