Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Loading Scene

Discussion in 'Scripting' started by TheeNeon, Jan 18, 2016.

  1. TheeNeon

    TheeNeon

    Joined:
    May 15, 2014
    Posts:
    4
    public void LoadLevel(string name)
    {
    Debug.Log("Level Loaded" + name);
    SceneManager.LoadScene(name,LoadSceneMode.Single);

    }

    While Watching a Course on Unity Scripting, we are now learning how to load scene by clicking a button. The code above is what i have written, the code that is used in the video uses the Application method which is obsolete.

    I have added my scenes to the build settings but when i click on the start button it gives me this error:
    Scene '' (-1) couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.

    Through reading the documentation it states that i must load the assets, does this apply to what i am doing or am i missing a line of code?
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148