- Home /
How to prevent a script from running until the scene is loaded?
I currently have two scenes: a start menu and then the actual game scene. You can access the game by pressing start, however the issue that I have run into is that my script which scrolls the camera constantly begins running as soon as the start menu is accessed. I am wondering how to essentially pause this script until the scene is loaded so that the camera starts at the position I desire.
Answer by $$anonymous$$ · Feb 20, 2017 at 10:19 AM
check out the following link, i think it would help
http://answers.unity3d.com/questions/1173303/how-to-check-which-scene-is-loaded-and-write-if-co.html
Answer by RonanSmithDev · Feb 20, 2017 at 02:25 PM
I know the other reply would probably be a more elegant method but you could potentially use yeild, and wait a set amount of time before the script runs:
https://docs.unity3d.com/ScriptReference/WaitForSeconds.html