- Home /
Mecanim animation pop while paused (timeScale == 0)
Hey all,
I'm running into an issue I could use some help on.
I want to create a model at runtime and run an idle animation on it while the game is paused (i.e. Timescale == 0f)
I am aware that Mecanim animations normally don't run while the timescale is 0, so the expected behavior is for the model to begin rendering in the idle animation's first frame.
However, when I instantiate the model I see it completely unanimated for a couple of updates before it actually enters the first frame of the idle animation. This is jarring, as the model pops from 'unanimated' to 'idle'.
This problem does not occur when I try this with the timescale at 1. It behaves as expected.
As an experiment, I even tried setting the animatorUpdateMode to "UnscaledTime". Then, I disabled the renderer on the model at object creation and let the game run paused with the model invisible. During this time, I observed the state machine in the inspector happily chugging along, looping through the idle animation clip. The moment I turn on the renderer, the model appears unanimated, and then snaps into the idle animation.
It's almost like Mecanim will only begin to operate on the rig when the object is rendering.
Help getting this thing to co-operate would be much appreciated :)