Hey guys when I have just made a full little web player but It is not up and running becuase of one problem when I click on text that is supose to return me to the main menu I end up back in level one??? I have checked the buuld settings and the script what could be wrong??? here is my code:
var isQuitButton = false;
var isMainMenuButton = false;
var isInstructionButton = false;
function OnMouseEnter()
{
//change the color of the text
renderer.material.color = Color.green;
}
function OnMouseExit()
{
//change the color of the text
renderer.material.color = Color.white;
}
function OnMouseUp()
{
//are we dealing with a quit button?
if (isQuitButton)
{
//Quit game
Application.Quit();
}
if (isMainMenuButton)
{
Application.LoadLevel(0);
}
if (isInstructionButton)
{
Application.LoadLevel(6);
}
else
{
//Load game
Application.LoadLevel(1);
}
}
I’m a scripting noob but is the main menu scene level 0?
or is it named something else, etc
cos my idea was that its loading level one because level one is the scene named in the Application.LoadLevel(0);
level 1 is 0, if you like
You may have a point…But I need to know how to fix it so it can stop doing this to me.
i would make sure that it specifically calls up the main menu scene, make sure that whatever you have called the main menu scene is typed where the 0 is in that line of code.
I tried that still didnt work.
I believe I might have solved it, go into build settings and make sure that the levels are in the right order so that the script you have calling them calls the right level (scene)
It can be a pita to get the numbers in the build settings to match up - say you have 20 levels.
Application.LoadLevel() also takes a string which is the name of the Scene… ie. “MainMenu”… and will load appropriate one.