I made very simple hours that count how long the match was going on. When I played a match after implementing this, I realised the hours are counting too fast and later I found out it was twice as fast it should have been. I didn’t play with timeScale, so that shouldn’t be it, but either way I divided Time.deltaTime by 2 in my code to get the correct real world time the game was played.
Then I realised that when playing, the hours move faster than they should. I played for a 40-50 ingame seconds and looked at my watch and the ingame minute came 20 second before the time it was last time I checked. (First time I checked my clock the minute was at 26 real world seconds. When I checked it after playing for 40-50 ingame seconds the ingame minute ended at around 06 of real world seconds)
The code of the clock is really simple:
float timeFromStartOfTheMatch;
void OnGUI() {
int seconds = ((int)timeFromStartOfTheMatch) % 60;
GUI.Label( new Rect( Screen.width / 2 - 200, 20, 400, 50), ((int)timeFromStartOfTheMatch / 60).ToString() + ":" + ((seconds < 10) ? "0" : "") + seconds.ToString() );
timeFromStartOfTheMatch += Time.deltaTime * 0.5f;
}
So what could be causing this?