- Home /
How can i make a main menu?
I make to make a main menu, i am trying to use 3D text and a Cube as the background but i'm having problems when i click on the 3D Text for it to go to the next sence, some is wrong with MonoDevelop, i check over and over to see if my script is correct and it is... For example: if i am a button (3d Text) to go to Help Menu and i write my Script as in:
var help : boolean;
var option : boolean;
function OnMouseUp()
{
if(help)
{
Application.LoadLevel(1);
}
else if(option)
{
Application.LoadLevel(2);
}
}
it will not go to help but go to option, and i check to see if the button is check for help in the inspector...
Please add debug statements to make sure a) that you're getting into the On$$anonymous$$ouseUp function, and b) that the values of help and option are what you think they are.
Ah this is an example, my Script i wrote works fine. I check it over and over to see if it's right but Unity is mixing up my levels in the build setting under file and i don't know if it's the language my script is rote in because i only know how to write C# only JAVA so i don't know if something is wrong with the language or Unity itself.
Unity doesn't mix up levels; post your code so you can get help.
I often use the name of my levels when loading them, LoadLevel(1) isn't very helpful at a quick glance.
Answer by LukeAntConroy · Feb 04, 2013 at 09:20 PM
Just something I had done previously it may help although it is in C# so you probably have to change it. Hopefully thats it helps.
public class Menu : MonoBehaviour {
public bool isQuit = true;
void OnMouseEnter()
{
renderer.material.color = Color.red;
}
void OnMouseExit()
{
renderer.material.color = Color.yellow;
}
void OnMouseDown()
{
if(isQuit)
{
Application.Quit();
}
else
{
Application.LoadLevel("Main");
}
}
// Update is called once per frame
void Update () {
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613091930im_/https://answers.unity.com/themes/thub/images/avi.jpg)