- Home /
Want to load scene after taking off in plane.
So I am still working on my first demo game in Unity. I have my two splash screens, starting and ending. Then, I have my two actual scenes. My game starts on splash screen, you press new game an it works as expected. My issue is at the end of the second scene, you get in a plane an fly away, after flying away for about 4 seconds in the air I would like the scene to end an load my ending splash screen but I can't figure it out. I can load the ending scene the moment you get in the plane but I wanted to allow for a few seconds of flying and I have yet to figure the timer setting out to be able to do this. Please someone help.
Answer by SGymme · Apr 11, 2021 at 07:30 PM
Use a IEnumerator for this
public float waitSeconds = 4f; //The time you want to wait
private void startTimer(){ //Call this method when entering the plane
StartCoroutine(wait());
}
private IEnumerator wait(){
yield return new WaitForSeconds(waitSeconds);
SceneManager.LoadSceneAsync("SceneName"); //Load your Scene after 4 seconds
}
Your answer
Follow this Question
Related Questions
CountDown Timer Help (Seconds problem) 2 Answers
How to make this display milliseconds? 3 Answers
Time does not start counting down when need to 1 Answer
Timer reset 1 Answer
Unity how to find load time? 1 Answer