Load level

How do I go about making a screen with a loading bar? I am using substancs all over the place and I would like it to be able to go from my main menu to a loading screen where it would load all the assets then take into game play?

Hello,

I made this little script that should do the trick, first you have to create a new scene(HAS TO BE VERY SMALL), with GUI or whatever(I used GUI) and apply this script to the GUI:

Trying to paste full code again :

 #pragma strict
 var level : String;
 var loadingbar : GUITexture;
 var MaxloadingWidth : float;
 
 function Update() 
 {
     if (Application.GetStreamProgressForLevel(level) == 1)
     {
         loadingbar.pixelInset.width = MaxloadingWidth;
         Invoke("Loadinglevel", .5);
     }

     if (Application.GetStreamProgressForLevel(level) <= 1)
     {
         loadingbar.pixelInset.width ++;
     }
 }
 
 function Loadinglevel()
 {
     Application.LoadLevel(level);
 }

Srry, can’t guarantee this to work, I got a very small scene to load so it loads immediatly. But I think this will work

Good luck,

Hybris

I don’t what plugins you have access to, if any, but one very easy way to do this is to use the UIBtnLoadScene in the EZ GUI library. All you need to do is add this control to the game object that will trigger the new scene to load, and specify what panel to show while the new scene loads (game objects are initialized).

I know this is a specialized solution since it uses the EZ GUI plugin, but I thought it was at least worth posting in case you currently use or are considering using EZ GUI.