Ok So Im starting up the game with this gamescript: Code (csharp): //-- Is used at start of level1: //-- Sounds: //var backgroundMusic : AudioSource; var startText : GUIText; //-- What happens?: function Start () { Time.timeScale = 0.0; //backgroundMusic.Stop (); //backgroundMusic.volume = 0.4; //backgroundMusic.ignoreListenerVolume = true; yield WaitForSeconds (0.9); startText.text = "Get Ready.."; yield WaitForSeconds (2.86); startText.text = "Set.."; //-- startup: yield WaitForSeconds (2.75); startText.text = "GO GO GO!"; Time.timeScale = 1.6; //backgroundMusic.Play (); //-- Hide text yield WaitForSeconds (0.80); startText.text = ""; } But as you can see, The Yield thingy is time-independent! So how do I work this out? Thanks!
I don't know, to pause the game a little while the player is getting ready.. I guess I could just set all rigidbodies in my scene to not be active, but I would rather have a single method of pausing everything. Does it make sense?
Yeah your way is probably the least hassle in the long run. I will add Time.realtimeSinceStartup to version 1.1.1 which returns time independent of time scale. You wont be able to use coroutines when setting timescale to zero, so you have to do it the old fashioned way overriding function Update () {}. You have to store when you started the game in a variable. Then inside Update you check if Time.realtimeSinceStartup has progressed far enough to let the game begin.
I've been playing with the v1.1.1b1 release a bit today and I just found that Unity no longer allows me to set Time.timeScale to 0. Is there an alternate way to stop the game in the case of a pause menu or something similar? Most of our project is physics-based and stopping time was an elegant solution to the problem. Is there another way to turn off physics calculations globally? -rob
1.1.1 is scheduled for monday, with another beta build tomorrow. (Note that this bug is only in 1.1.1b1 not in 1.1)
Sweet! Yeah, I was using 1.1 until yesterday. I was curious because our project is on a short timeframe so I wanted to get an idea of whether to go back to 1.1 or work on other things if that fix would be available before we planned to have our game finished. Thanks for the quick replies! It's great that you guys update Unity so quickly, too. -rob