is it possible to reset Time.time
I'm having some issues with a timer. I want the time to be persistent after my player dies and starts from checkpoint. (reloading scene). But when my lives run out and I go back to the Main Menu, I want the timer to reset.
If I use Time.time, the timer persists after the player dies, but I cannot find a way to reset this time at the start of a new game. (I've read that it's not possible without closing the application).
if I use Time.deltaTime, the timer restarts from 0 when the level reloads. (not what I want).
How could I go about this? Any help is greatly appreciated!
Answer by tormentoarmagedoom · Jun 25, 2018 at 11:43 AM
Good day.
you are little loost my friend...
Time.time can no be changed, is the time in seconds from the start of the game, the app.
Time.deltaTime is reset to 0 every frame (this means a lot of time every second) Time.DeltaTime is just to know how many time has pased from last Update method.
You need to create you own timer if want to know who many time has passed from une moment 1 to moment 2. So you only need to store the Time.time of one moment, and see the Time.time of the other moment, and...:
float TimePassed = RecordedTime1-RecordedTime2;
This will give you the seconds passed from momnet 1 to moment 2
This gives you the answer you need. Go create your timming system!
Good luck! Bye! :D
Your answer
Follow this Question
Related Questions
How to shake the virtual camera when time scale is 0? 0 Answers
Milliseconds Timer Question 1 Answer
20 minute countdown timer 2 Answers