Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Bug Unity 2019: State machine freezes when multiple transitions have unordered interruptions

Discussion in 'Animation' started by tgiddings000, Jun 25, 2023.

  1. tgiddings000


    Mar 1, 2021
    I am required to use Unity 2019.4.31f1 since I am making third-party content for VRChat. While it's hard for me to see this behavior and not think "bug!", it's sometimes hard to know for sure that something is a bug and not an unknown error on my part, and since it appears that the support window for this version has ended, I don't expect to be able to take advantage of any bug fix. As such, I need help coming up with workarounds or gaining a better understanding of what Mecanim is trying to do here.

    Here is a small reproduction of the issue. All of the states are just the result of new -> empty state and haven't been edited further. This issue does occur with states with real animations, though.

    The intention is that if the transition conditions for Start -> State A and Start -> State B are mutually exclusive, and that if the animator is transitioning to one when the conditions are reversed, it will instead start transitioning to the other. If the player were to contrive a situation where the conditions are going back and forth too quickly for the animator to complete a transition, then the correct response would legitimately be for the animator to go back and forth between trying to transition to State A and trying to transition to State B.

    In this kind of mutually-interruptible situation, it's my understanding that this requires all but one of the transitions to have "ordered interruption" unchecked. However, when the condition is met for one of the transitions with "ordered interruption" unchecked, the animator gets stuck, as shown:

    In a real animator controller, the details of how it gets stuck can get strange -- with the states and transition showing different levels of progress when it gets stuck, and with the transition sometimes resuming when its conditions become unmet. I wasn't able to easily reproduce more than the mere fact that it gets stuck when using unordered interruptions, though.

    I'd like to know if anyone has insight into why Mecanim gets stuck in this situation and what options there are to work around this. I want to avoid the states motions just being static poses, but if a workaround requires that to avoid hard snaps, then I would definitely be able to live with it.