- Home /
 
Help with time.time when new scene starts.
     private float nextEggTime = 0.0f;
     private float waitTime = 4.0f;
     private float spawnRate = 1.2f;
 
     void Update () {
             Debug.Log (Time.time);
             if (waitTime < Time.time)
             {
                 SpawnEgg();
                 nextEggTime = Time.time + spawnRate;
                 //Speed up the spawnrate for the next egg
                 spawnRate *= 0.99f;
                 spawnRate = Mathf.Clamp(spawnRate, 0.85f, 99f);
                 waitTime = nextEggTime;
             }
         }
 
 
 
               I want the SpawnEgg to start 4 second after the scene starts and this was working until i added my start scene and now this scene is at second place.( and time.time is running ) on clicking 'play button' this scene starts but because the Time.time is still running i can not get that 4 seconds behaviour again.
"is there a counter which starts for every scene ?" if not what changes i should make here ?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by C-Blunt · Dec 05, 2014 at 11:21 AM
Try timesincelevelload...
     void Update () {
    if (waitTime < Time.timeSinceLevelLoad)
     
     ...
 
 
               Hope that helps.
Your answer
 
             Follow this Question
Related Questions
Stop and Resume Timer 0 Answers
Changing light intensity over time via mathf.lerp 2 Answers
Why Won't This Message Log Into My Console? 1 Answer
Quit game after timer reaches 0 1 Answer
How to reset Time.time ? 1 Answer