Timeline Not Pausing On Time
Posted: Sat Apr 08, 2023 4:18 pm
Hello,
Something I noticed is that when you set a Timeline's speed to 0 with a conversation clip, it does not pause the timeline immediately. (Example: Timeline(speed, TimelineManager, 0);
After some testing, if you were to pause the Timeline using a Signal Emitter that calls a method that pauses the Timeline like this, the same delay before the pause happens:
So, it looks like this is a fault with Timeline not being able to pause immediately.
However, this is a problem with games that need to pause for dialogue/player input. Depending on the framerate the game is running at, there are varied results of when the Timeline will actually pause. So, animations that are supposed to happen after the pause, might start happening before the pause depending on how long it takes the Timeline to pause.
A very brittle workaround is simply adding a bit of padding to give the Timeline time to pause, but that comes with its own issues. If the machine is high performance, It will pause a bit after its told to. Then there will be a brief wait time where nothing happens. There's also no guarantee that the padding will be long enough for low end machines to pause the Timeline in time.
So, I say all of that to ask this -
Is there an elegant way to consistently stop a Timeline so that you can display dialogue/wait for player input, that also guarantees that the pause won't happen too late and show animations that shouldn't be happening yet?
Thank you
Something I noticed is that when you set a Timeline's speed to 0 with a conversation clip, it does not pause the timeline immediately. (Example: Timeline(speed, TimelineManager, 0);
After some testing, if you were to pause the Timeline using a Signal Emitter that calls a method that pauses the Timeline like this, the same delay before the pause happens:
Code: Select all
public void StopTimeline()
{
director.playableGraph.GetRootPlayable(0).SetSpeed(0);
StartCoroutine(GameEngine.Instance.DialogueManager.TriggerCutsceneDialogue(currentCutsceneDialogue));
}
However, this is a problem with games that need to pause for dialogue/player input. Depending on the framerate the game is running at, there are varied results of when the Timeline will actually pause. So, animations that are supposed to happen after the pause, might start happening before the pause depending on how long it takes the Timeline to pause.
A very brittle workaround is simply adding a bit of padding to give the Timeline time to pause, but that comes with its own issues. If the machine is high performance, It will pause a bit after its told to. Then there will be a brief wait time where nothing happens. There's also no guarantee that the padding will be long enough for low end machines to pause the Timeline in time.
So, I say all of that to ask this -
Is there an elegant way to consistently stop a Timeline so that you can display dialogue/wait for player input, that also guarantees that the pause won't happen too late and show animations that shouldn't be happening yet?
Thank you