Answers for "load scene just one time use game in unity"

C#
1

how to make a specific scene load only on game start in unity

Unity automatically loads whichever scene has an index of 0 in the build settings.
  
If you want a specific scene to load on start, drag it to the top in the build settings.
  
The build settings are in file > Build Settings at the bottom of the dropdown.
Posted by: Guest on August-08-2021
1

Unity c#loading a scene after a few seconds

void Start()
{
    //Start the coroutine we define below named ChangeAfter2SecondsCoroutine().
    StartCoroutine(ChangeAfter2SecondsCoroutine());
}

IEnumerator ChangeAfter2SecondsCoroutine()
{
    //Print the time of when the function is first called.
    Debug.Log("Started Coroutine at timestamp : " + Time.time);

    //yield on a new YieldInstruction that waits for 2 seconds.
    yield return new WaitForSeconds(2);

    //After we have waited 2 seconds print the time again.
    Debug.Log("Finished Coroutine at timestamp : " + Time.time);
    //And load the scene
    Application.LoadLevel("Game");  //<-- This is the correct name of the scene
}
Posted by: Guest on July-11-2021

C# Answers by Framework

Browse Popular Code Answers by Language