How to use time, when timeScale is 0?
As the title says, I'm trying to use time when timeScale is 0.
To example :
float score;
void Start()
{
Time.timeScale = 0;
}
void Update()
{
score += time.deltaTime;
}
This doesn't work since time.deltaTime = 0
because time.timeScale = 0
Is there any alternatives to this? :)
Thank you ^-^
Answer by SBull · Feb 24, 2016 at 08:04 PM
It depends on what you are doing, but you could try Time.unscaledDeltaTime or Time.realtimeSinceStartup.
unscaledDeltaTime ignores the current timescale and realtimeSinceStartup counts using the actual time since the scene was started. Hopefully one of those works for you.
Time.unscaledDeltaTime
was exactly what I needed! Thank you! :D
$$anonymous$$y pleasure. Don't forget to accept the answer as correct. ;-)
Answer by Tommy4421 · Jan 21, 2021 at 01:13 PM
There is an new method now: yield return new WaitForSecondsRealtime(time);