Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

loading scenes in game as you need them

Discussion in 'Editor & General Support' started by Deleted User, Mar 12, 2016.

  1. Deleted User

    Deleted User

    Guest

    Hi, is there a way for my game to load faster in a browser by my loading scenes only as the player needs them instead of loading the entire game from the moment they load the game index.html page? please.
     
  2. Ignacio-Liverotti

    Ignacio-Liverotti

    Unity Technologies

    Joined:
    Jul 23, 2015
    Posts:
    36
  3. Deleted User

    Deleted User

    Guest

    Thanks very much Ignacio. To make this script work with a scene, do I create an empty game object and attach the script? Also, will I need a loading progress bar for each scene? Please. Thank you.
     
  4. Ignacio-Liverotti

    Ignacio-Liverotti

    Unity Technologies

    Joined:
    Jul 23, 2015
    Posts:
    36
    Hello silverglade,

    There are no fixed rules on how to approach this, but usually yes, you'd have a 'Manager' object with a script attached to it in order to take care of all this stuff.

    As for the loading bar, one way to do it would be to have a 'Loading Bar' prefab object that you instantiate right before loading a new scene instea of having a separate loading bar element for each scene. This way, if you make any changes to the loading bar prefab, you don't have to go and tweak the loading bar for each scene.

    Also, I re-read your original message and realized that you want to load one level at the time. If that's the case, then the 'Aditive' LoadSceneMode might not be what you need. The 'Single' (http://docs.unity3d.com/ScriptReference/SceneManagement.LoadSceneMode.Single.html) mode might be useful as well.

    Try to do a small project that starts with a scene and swiches to a new one by pressing a button. This way, you'll understand the problem and the solution better, and then you'll be able to integrate it into your existing game a lot faster.

    Best,
     
  5. Deleted User

    Deleted User

    Guest

    Awesome. Thank you for writing that. I will do what you said.Thanks for taking the time. Happy Spring.
     
    Ignacio-Liverotti likes this.