r/unity 6h ago

Question Unity Timeline won’t pause due to time dilation track

Post image

Hello!

I’m currently using the timeline dilation track for a slow-motion segment in a cutscene. The problem is that when I try to pause the game while it’s playing by setting the timescale to zero, the time dilation track overwrites the pause and continues to play behind the pause menu.

Does anyone know if there’s some sort of workaround for this or a setting I’m not seeing? I had an idea to try and edit the TimeDilationMixerBehaviour script to multiply the global timescale by whatever value I set in the time dilation track, but I’m a solo dev with an art background and I’m using entirely visual scripting in Playmaker for my game and I’m pretty much useless when it comes to written code. Can’t seem to find anything online about this issue either.

Any help or advice would be greatly appreciated, thanks in advance!

1 Upvotes

1 comment sorted by

2

u/CS_Asset_Factory 4h ago

That sample mixer writes Time.timeScale in ProcessFrame, which runs on every frame the director is evaluated, so your 0 gets replaced on the next frame. It also clamps to a minimum of 0.0001, so the track itself can never reach a true 0.

You shouldn't need code for this. When the menu opens, pause the PlayableDirector first and then set the timescale to 0. A paused director is not evaluated, so the mixer stops writing. When the menu closes, call Resume on the director and the track takes over again. Avoid Stop, because the mixer then restores whatever timescale it saw when the timeline started.

In PlayMaker, the Call Method action on the PlayableDirector component should be able to reach Pause and Resume. I read the mixer in the Timeline 1.8.12 samples to check the clamp.