Hello !
I’m just making an appi for the web.
I want to load level per level with DontDestroyOnLoad too keep some elements :
level 1 : introduction (to destroy) GUI camera (to keep)
level 2 : the GUI elements (to keep)
level 3 : the 3d objects (to keep)
level 4 : firts person controller (to keep of course)
I use Application.LoadLevel at each Level to load the new one : when the Level X is loading, then load the level X+1
var Niveau :float=1;
function Start () {
if(Application.CanStreamedLevelBeLoaded(Niveau)) {
Application.LoadLevel(Niveau); // load the game level.;
}
}
I’m newbie in Unity.
So at first i’m wondering if it’s the good way to do for the web ?
And then how can i do a percentage loading for each Level …?
thanks !!
hey thanks
but i’ve already check this page.
I don’t want in fact to customize the global unity loader, but to make one for each level loaded and in percentage, you know.
And for CanStreamedLevelBeLoaded or GetStreamProgressForLevel, i don’t really understand how does it work’s really… there is no example. Could you give me one maybe ?
And i’ve another problem with the Web Player Streamed. When i build my project with the Normal Web Player (without streaming), it works well. But with the streaming, the differents Levels don’t load, I’v just a blank page. did you know why?
thx
just to said, that’s with the streaming, it works on the localhost but not on the web…
Here is my StartMenuGUI script that is attached to the scene camera:
var isLoading : boolean = false; // if true, display the "Loading..." message.
private var loadingStatus;
function OnGUI()
{
if (isLoading) {
loadingStatus = Application.GetStreamProgressForLevel("Level1");
GUI.Label ( Rect( (Screen.width/2)-150, (Screen.height / 2) - 130, 350, 60), "Loading..." + Mathf.Round(loadingStatus * 100) + "%", "mainmenutitle");
if(loadingStatus == 1.0)
Application.LoadLevel("Level1");
}
}
The isLoading variable is set when a buton is pressed. (It will of course be loading in the background, just the percentage isnt being displayed on screen before it’s pressed)
Part of button script:
...
var other : StartMenuGUI = FindObjectOfType(StartMenuGUI);
other.isLoading = true;
It’s important to make sure the GetStreamProgressForLevel is at 1.0 before attempting the load level. It will probably work on your localhost, but lockup when deployed if not.
Hope this helps
I am having the same problem with the FPS Tutorial project. When I build it as steaming it fails to load on the web but works correctly local. On the web all I get is a black screen in the player. You can hear the sound however. Is there something that needs to be added to make the Tutorial project work in steaming mode?
Thanks
did you solved this? same problem here, it works locally but not on web?