Is it possible to play animations while the TimeScale is 0? I’m talking about bone animations imported from Maya.
The basic scenario is that i have a bunch of rigidbodies on screen, i’d like to “pause” the screen on a button press, which plays an animation and turns timeScale to 0. But because timeScale is 0 animations won’t play at all.
Is there any way of achieving this?
I’ve got another method where i use delegates and events to notify objects when i’ve entered “pause mode”, but i thought that just turning the timeScale down would be more efficient than N method calls.
Thanks
//edit//
One idea that i do have is that i could write an extension for the AnimationClip class for a new function to play the animation, but also pass in a flag (ignoreTimeScale), if this flag is true, then i could scrub through the animation using a while(animation.time < animation.length). Or something like that. Thoughts?
I pretty much did it the way you said in your edit. Base it off the timed components from the animation, and create a coroutine that I kept track of in my own List and based other functions that coincided with it off of Time.realtimeSinceStartup. This was just a helper timer to base coroutines off of since coroutine yielding is also derived form timeScale.
Might I ask how someone goes about creating a
“creating an animation extension function”? Does AnimationExtensions have to be its own public static class? Or is there another method to do this? Thanks.
So I copied and pasted the c# script above and get these errors in the console. I never work with C# (only JS) and couldn’t work out what the problems are… can you help?
For the main script:
/AnimationExtensions.cs(1,28): error CS0116: A namespace can only contain types and namespace declarations
[is pointing to the following line in the script: public static IEnumerator Play( this Animation animation, string clipName, bool useTimeScale, Action onComplete ) ]