Turns out the code was ok, it was just on a GameObject that was destroyed after a few seconds so the timer never reached the desired count
Help with a timer
I'm trying to have my game speed up over time, the game starts at stage1 speed, after a period of time should progress to stage 2 speed and then stage 3 speed. I seem to be having an issue getting the game into stage 3. But I can get the game into stage 2, the code I have is as follows, I cannot understand why the debug.log will output stage2 but never stage3, can anyone help.
Also the console continuedly outputs "stage1" even when stage1active is set to false
 float timer = 0f;
 
 private void Update()
     {
         timer += Time.deltaTime;
 
         if(timer < 10f)
         {
             stage1Active = true;
         }
         if(timer > 10f && timer < 20f)
         {
             stage2Active = true;
             stage1Active = false;
         }
         if(timer > 20f)
         {
             stage3Active = true;
         }
 
         if (stage1Active)
         {
             speed = 2f;
             Debug.Log("Stage1");
         }
          if (stage2Active)
         {
             speed = 8f;
             Debug.Log("Stage2");
         }
         if (stage3Active)
         {
             speed = 25f;
             Debug.Log("Stage3");
         }
     }
Answer by Hallinan · Jan 16 at 04:24 PM
I have just noticed that stage2Actice is never set to false, so this may be part of the problem. But still not sure why "stage1" is outputting to the console constantly.
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                