Search Unity

How to load a level (scene) in another scene (Open world)

Discussion in 'Editor & General Support' started by ahmedsaed2652003, Aug 21, 2020.

  1. ahmedsaed2652003

    ahmedsaed2652003

    Joined:
    Mar 25, 2020
    Posts:
    5
    Hi,

    I finished building the city and the AI and other staff, Now it's the time for level designing

    I don't want to create the levels inside the world for a better performance
    let's say that i am going to create 10 levels each level has at least 50 Gameobjects(3d models). This means that i have 500 Disabled Gameobjects.

    I am trying to figure out a way to load the level From another scene (eg: level 1) into the Main Scene(world)

    So when i want to load a level l just load it's scene and after finishing it, I destroy That scene

    More info:

    level 1 starts in building and the rest of the mission is outside that building (in the world). So, i want to be able to load level 1 building's furniture and other staff and destroy them once the mission is finished
     
    Last edited: Aug 21, 2020
  2. ahmedsaed2652003

    ahmedsaed2652003

    Joined:
    Mar 25, 2020
    Posts:
    5
    I figured it

    You can use:

    Code (CSharp):
    1. SceneManager.LoadScene("The name of the scene", LoadSceneMode.Additive);
    For better preformance (no freezing) :

    Code (CSharp):
    1. SceneManager.LoadSceneAsync("scene name", LoadSceneMode.Additive);