Quantcast
Channel: Questions in topic: "preload"
Viewing all articles
Browse latest Browse all 15

How to preload a scene with progress bar so it can start instantly?

$
0
0

So we have a huge level that takes like 10 seconds to start up from the moment we switch to it's scene - so I need to have the level preloaded with a progress bar (or at least some kind of animation) to cover it.

I found Application.LoadLevelAsync which turns out to be useless. It does let me load the level asynchronously for ten or so frames, but the problem is that it still takes the same amount of time after the LoadLevelAsync is done. It appears that the problem is that all the assets used by the level aren't actually loaded until we actually switch to the scene.

So how can I load the assets used by a scene asynchronously while still getting to draw the current scene? If I can't do that directly in one operation, how can I find what the assets used by a scene are, and how can I then preload those assets?

thanks!

P.S. since people asked for code, below is some loading code I use that isn't solving the problem - basically the async operation finishes very quickly, but then the loader screen stops drawing for many seconds until the loaded level draws it's first frame


public class MainMenu: MonoBehaviour     
{    
    public int counter = 0;     
    public AsyncOperation loadOp;

    void Start()    
    {   
        loadOp = Application.LoadLevelAsync("freewayLevel");    
    }

    void OnGUI()    
    {    
        string loadString = "Loading "+loadOp.progress.ToString()+"%";    
        //TEMP: trying to see if loadlevelaync works or not...    
        counter++;    
        loadString += " (" + counter.ToString() + ")";    
        GUILayout.Label(loadString);    
    }    
}

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>