Probably something really simple that I miss…
I have an object in my scene that I want to animate between two states (for simplicity, picture a chest that can be either open or closed). I figured, the Animator with its state machine would be perfect for this. I created four states, one for each the opening and closing animation (these are imported as part of the model, not created in Unity) and two states in between which should not do anything. I can then use a Trigger to start the opening and closing animation.
The problem I have now is, that after the open-animation is finished and the ‘pause’-state is reached, the chest model jumps back into the closed state.
Things I tried:
-create additional animations from the model, each only a single frame
→ did not work
-set the ‘Speed’ in the ‘pause’-states to 0
→ state machine did not react to the trigger to exit the ‘pause’-state
-set animator.speed via a Behaviour to 0 (in OnStateEnter) and back to 1 (in OnStateExit)
→ same as above
In the legacy animation system I would just have set the Animation to ‘Clamp Forever’, but I can’t find a similar option in the new system.
A workaround I found, was to create two frame long animations, but that is not really clean.