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

Web player loading bar for next scene...

Discussion in 'Scripting' started by g2mediagroup, Dec 16, 2011.

  1. g2mediagroup

    g2mediagroup

    Joined:
    Jun 25, 2011
    Posts:
    98
    Code question...

    Ok, here's the lowdown:

    1) We have a Menu scene, the Game scene, then Score scene (simplified) for web player distro...for now.

    2) We set the First Streaming Level 0 (as default, the Menu), loaded Menu scene fairly quickly, click "Start" to go to the actual Game scene...and sits there...sits there...sits there...sits there...in the meantime, people are clicking the heck out of the "Start" button wondering why it's not loading, soooooo....

    3) We set First Streaming Level to 1 (our Game scene), thinking it won't display Menu scene until Game scene is loaded...but this achieved NO DIFFERENCE in delay after clicking "Start" in Menu scene...sigh.

    With this in mind, we decided we definitely need at least a loader bar (as visual feedback to the player) to let them know SOMETHING is happening during the delay while loading the Game scene...and yes, I've read about the "GetStreamProgressForLevel" and "CanStreamedLevelBeLoaded" but we're designers and not really coder-types, so can someone show WORKING code (not THEORETICAL code) for doing this?

    We would like to re-use our custom progress bar that we are currently using for the web player loader, just have it show after player clicks "Start" or any other scene from the Menu choices...

    LINK: http://clients2.g2mediagroup.com/cmc..._20111215.html

    Thanks for any help!
     
    Last edited: Dec 16, 2011
  2. BotMo

    BotMo

    Joined:
    Mar 2, 2011
    Posts:
    101
    I've run into this too. As far as I know, you don't have any choice except to wait for level resources to load. You can however, make a "loading" level which just displays your loading screen and loads things in the background. Then, when everything is loaded, go to the next level.

    something like this:

    application.loadlevel(1); //your loading "level"
    **new level stats, loads an object with this script on it**
    start(){
    instiantate(gameobjectname);gameobjectname.DontDestroyOnLoad;
    **and when all the loading is finished**
    application.loadlevel(2);
    }

    Another option, which is just a hypothesis, is maybe you can do something with different object's Awake(). when the object becomes awake, make it change your "loading" bar.

    I dealt with it by loading all of my objects when the game loads, then i let them get destroyed (because they really are still in memory) and they just load faster in the next level. You could do this if your menu doesn't eat up alot of resources and those objects are used in the next level. This worked better for me though because I only have about 6mb worth of resources :p