Problem with compiled exe

I have finished a Alpha build of our game. I have 20 scenes. I can load the scenes called: “Main Menu”, “Credits” and “Level” but I can’t load my normal levels. I attached a loading screen to load the normal levels. Now when i click my play button the different loadingscreen change all second and my level can’t get loaded.

The thing is this only happens when i play my .exe. When i run my game in Unity this all works perfect.

Here is my script for the loadingscreen:

#pragma strict
static var LoadingScreenON = true;

	
//Textures
var loadingscreen1 : Texture2D;
var loadingscreen2 : Texture2D;
var loadingscreen3 : Texture2D;



function Start () 
{

 	if (Loadingscreen.LoadingScreenON == true)
 	{
 		
 		Loadingscreen.LoadingScreenON = false;
 		guiTexture.enabled = false;
 	
 	}

}



function Update ()
{

 if (Loadingscreen.LoadingScreenON == true)
 {

 	RandomPic();
	
 	guiTexture.enabled = true;
 	guiTexture.pixelInset.x = 0;
    guiTexture.pixelInset.y = 0;
    guiTexture.pixelInset.width = Screen.width;
    guiTexture.pixelInset.height = Screen.height; 	
 }

}
function RandomPic()
{
	var randPic = Random.Range(0, 2);
	var chosenPicture = randPic;
	
	switch (chosenPicture)
	{
		case 0:
			guiTexture.texture = loadingscreen1;
		break;
		case 1:
			guiTexture.texture = loadingscreen2;
		break;
		case 2:
			guiTexture.texture = loadingscreen3;
		break;
	}
} 

Do you know what I’m doing wrong ?

EDIT: I think the problem is the loadingscreen it just won’t disapear. How can I fix that ?

Where's your level loading code?

I added the script. Sorry for that.

1 Answer

1

Well there’s nowhere in that script that loads a level (i.e. no Application.LoadLevel() call).

If you think the problem is that the level is being loaded but the GuiTexture is rendered in front of it, then you need to add something like the following to Update():

if (Loadingscreen.LoadingScreenON == false) texture.enabled = false;

I have another script which turns the LoadingsScreenOn to true and after that calls Application.LoadLevel. And i added this line into the Update function of the Loadingscreen-script. if (Loadingscreen.LoadingScreenON == false) texture.enabled = false; EDIT: Now it works. I added another line on a script in my game which turns the the loadingscreen variable to false.