Webplayer Glitch when Game has More than One Scene

My game has 3 scenes, first logo screen, second, title screen, and third the game. When I make a webplayer of just the game it works and loads fine, but when I add the logo and title screen to the webplayer game it doesn’t load properly.

When I do this the game either loads a weird blank texture-less scene with no GUIs and no game play or it just loads a blank purple screen. What’s even more weird is that if I wait like 5 mins the game will eventually load (sometimes) it’s like the webplayer loads the logo screen and then loads the title screen separately with no loading indication.

Here’s a visualization so you know what I’m talking about:

My codes I’m using:

For the logo:

var win: boolean = false; 

function WaitandLoad() 
{ 
   yield WaitForSeconds (0); 
   Application.LoadLevel ("Title"); 
   
} 

function OnTriggerEnter(other: Collider) 
{ 
            if (other.CompareTag("Player")) 
            { 
			
         print ("win is true"); 
         win = true; 
WaitandLoad(); 
 } 
}

For the Title:

//@script ExecuteInEditMode()
var gSkin : GUISkin;
var backdrop : Texture2D;
private var isLoading = false;
function OnGUI()
{
if(gSkin)
GUI.skin = gSkin;
else
Debug.Log("StartMenuGUI : GUI Skin object missing!");
var backgroundStyle : GUIStyle = new GUIStyle();
backgroundStyle.normal.background = backdrop;
GUI.Label ( Rect( ( Screen.width - (Screen.height * 2.05)) * 0.75, 0, Screen.height * 2,
Screen.height), "", backgroundStyle);


//Where the scripts are assembled
if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height -115, 140, 26), "Play"))
{
isLoading = true;
Application.LoadLevel("cyberspacedefender");
}
var isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer ||
Application.platform == RuntimePlatform.WindowsWebPlayer);
if (!isWebPlayer)
{
if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 80, 140, 26),
"Quit")) Application.Quit();
}
if (isLoading)
{
GUI.Label ( Rect( (Screen.width/2)-110, (Screen.height / 2) - 60, 400, 70),
"");
}
}

I’m new to unity but - are you making stuff thats designed with nodestroy? i believe that you need to explicitly tell unity what will not be destroyed between scenes. So if you added stuff in scene 0, it won’t get passed to scene1, unless you tell it to keep it.

How do I do that I’m using these to switch between levels:

For the logo:

var win: boolean = false; 

function WaitandLoad() 
{ 
// this is a 5 sec delay, I used because I show a GUItexture first. Remove this for instant load 
   yield WaitForSeconds (0); 
// this loads the Scene which has Index 2 in build settings 
   Application.LoadLevel ("Title"); 
   
} 

function OnTriggerEnter(other: Collider) 
{ 
            if (other.CompareTag("Player")) 
            { 
			
         print ("win is true"); 
         win = true; 
WaitandLoad(); 
 } 
}

For the Title:

//@script ExecuteInEditMode()
var gSkin : GUISkin;
var backdrop : Texture2D;
private var isLoading = false;
function OnGUI()
{
if(gSkin)
GUI.skin = gSkin;
else
Debug.Log("StartMenuGUI : GUI Skin object missing!");
var backgroundStyle : GUIStyle = new GUIStyle();
backgroundStyle.normal.background = backdrop;
GUI.Label ( Rect( ( Screen.width - (Screen.height * 2.05)) * 0.75, 0, Screen.height * 2,
Screen.height), "", backgroundStyle);


//Where the scripts are assembled
if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height -115, 140, 26), "Play"))
{
isLoading = true;
Application.LoadLevel("cyberspacedefender");
}
var isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer ||
Application.platform == RuntimePlatform.WindowsWebPlayer);
if (!isWebPlayer)
{
if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 80, 140, 26),
"Quit")) Application.Quit();
}
if (isLoading)
{
GUI.Label ( Rect( (Screen.width/2)-110, (Screen.height / 2) - 60, 400, 70),
"");
}
}

Anyone?

DontDestroyOnLoad()

Where did I say DestroyOnLoad()? Or does it do that automatically? Where would I add DontDestroyOnLoad() to my script?

Like?:

var win: boolean = false; 

function WaitandLoad() 
{ 
   yield WaitForSeconds (0); 
   Application.LoadLevel ("Title");
   DontDestroyOnLoad(); 
   
}

Thanks

Tried and tried and all I get is:

Assets/Title.js(22,18): BCE0017: The best overload for the method ‘UnityEngine.Object.DontDestroyOnLoad(UnityEngine.Object)’ is not compatible with the argument list ‘()’.

I don’t know where you guys got DontDestroyOnLoad(); but it doesn’t work any other ideas or ways?

there is a very usefull script ref which has example code :

Thanks, but that doesn’t work it just blends my game with my title and messes everything up. What else could I do this is so frustrating…