I want to pause my PlayableDirector until a script completes a task (fetching data from a remote server).
To do this, I send a signal to this script and from this script I’m trying to pause the director and resume it after I get the data.
It works, but with a weird glitch I cannot solve - I can’t find a method of pausing the director so that it will still apply extrapolation to animation clips. If I simply call director.Pause()
, the animated transform resets to how it was before the animation. I also tried setting timeUpdateMode to Manual and calling Evaluate in a coroutine with deltaTime = 0
, but that doesn’t help either. I also tried calling the Evaluate with a very small delta time, like 0.001f * Time.deltaTime
, same effect.
I guess I can do a hack and just extend the extrapolated animation so that there’s no extrapolation during the pause, but is there a better solution?
EDIT: actually, extending the clip didn’t help. Looks like PlayableDirector doesn’t apply its values at all when paused, which makes sense, but there should be a way to do this manually, like the Sample method on AnimationClip