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 ?