Hi, I'd like to turn off the automatic Unity animation... and control the time steps myself.... For example... each frame, I don't want unity to update the mesh, calculate bones and blend shaped and render.... I just want it to remember last state and render.... Then under my control of script... I want to tell it ok... add X time now.. (or subtract) and re-calculate the mesh output.. Basically I want control over when animation update happens on each animated object... for some advanced time slicing... If I set animation speed to 0, and add time manually this will probably work visually... but is UNity still all doing the same Work behind the scenes anyway (re-calculating everything) ? Is this possible ? if so how ? and would it work for both mecanim and legacy animations ? Thanks in advance for any help.
I am looking for something like this as well. The closest thing I have found so far is https://docs.unity3d.com/ScriptReference/Animator.Update.html It is not clear to me how this interacts with the usual update of the animator before LateUpdate though.
Thanks Chris, You can do this, per animation clip.... to artificially change speed of each animation seperately... animation["idle"].speed = 0.25; // run idle animation at quarter speed. And presumably you can set that to 0 speed. Then use this to set the time... animation["idle"].time = 0.25; // or it might be "animation["idle"].normalizedTime" ...or use the function you linked to above to advance time. That should work... But I'm not sure what Unity is doing if you set speed to 0.. is it still doing all skinning calculations... or is there a big performance saving, while its set to 0.
You can take the animation and set its time yourself Code (CSharp): Animation myAnimation; ... myAnimation.clip.SampleAnimation(myAnimation.gameObject, <timeInSeconds>); I used this for offline video rendering