What's the best way to create a independent clock (that can be sped up by changing the timescale)?
I'm making a survival game. To make walking times realistic but not boring, the time will be sped up, so the clock must be independent to the actual time.
What's the best way to do this?
You have several options to choose from, but all of them incorporate multiplying the change by a factor:
- Save the very first time the game startet. Always take the current time and subtract the start from it. multiply that by 1.5 and you have 150% sped up time
- You can also take the Time.deltaTime, multiply that by a factor and use the accumulated time as the time for the clock
There's not really a best way, it depends on your needs
would this work?
using UnityEngine;
using System.Collections;
public class TIme : $$anonymous$$onoBehaviour
{
public float Time1;
void Start ()
{
}
void Update ()
{
Time1 = Time.time + 1;
}
}
Your answer
Follow this Question
Related Questions
sync directional lights rotation with in game custom clock 0 Answers
A Good Substitute For yield WaitForSeconds() 0 Answers
Animation Won't Play Before My Time Freeze. 0 Answers
How to Make Timer (Score) Count Up Faster? 1 Answer
How can I have Time.maximumDeltaTime be unaffected by Time.timescale? 0 Answers