- Home /
Continuously Play Animation Forwards and Backwards with Mechanim
I have two animation clips for a door:
DoorOpen starts with the door closed at frame 0 and ends with the door moved to the right and open at frame 60.
DoorClose starts with the door open at frame 0 and ends with the door moved to the left and closed at frame 60.
I want to continuously go back and forth between these animations so the door opens, then closes, then opens, then closes forever.
To achieve this I set an animator with two states - doorOpen and doorClosed. The door starts in doorClosed, plays the animation to open the door, then transitions to the doorOpen state, which plays the animation to close the door and so on. The state machine looks like this:
The two transitions have the condition "Exit Time: 1", which from my understanding should mean that the moment the state has finished playing its animation, it transitions to the other state.
My problem is that this does not work. The observed behavior in game is that the door opens, then closes, then does nothing for about a second, then plays the open and close animations again. Why is this happening? From my understanding of how I have set it up, I should be seeing open, close, open, close, open, close in a tight loop with no delays between transitions.
Other things I have tried are setting the exit times to 0, and un-checking the "Atomic" box for the transitions. Neither of these have the desired effect.
Your answer
Follow this Question
Related Questions
Animator switches animation without trigger 0 Answers
How to disable/override a part of an animation created in Unity 2017.4 0 Answers
How can I make a state pass after a reversed state? 0 Answers
Setting Animator animations time. 1 Answer
How to setup this melee animation system in Mecanim? 1 Answer