- Home /
Main menu load function in c#
Iam making a main menu in unity and i got a "start game" function and a quit game function that is working fine. But i got a load option that doesnt work. Can someone help me with this. I want the main menu to go to another "window" when the user click the text Load Game. This is my code
using UnityEngine;
using System.Collections;
public class MenuObject : MonoBehaviour { public bool isQuit = false; void OnMouseEnter() { renderer.material.color = Color.blue;
}
void OnMouseExit()
{
renderer.material.color = Color.white;
}
void OnMouseDown()
{
if(isQuit)
{
Application.Quit();
}
else
{
Application.LoadLevel(1);
}
}
}
I have followed this tutorial: http://www.youtube.com/watch?v=yjCEGIVj84Q
Answer by Bicko · Feb 10, 2012 at 11:15 AM
For ease of readability, I tell my LoadLevel functions to look for the level name instead of the integer that represents it. I.e. Application.LoadLevel("Level01");
It's also worth going in to File > Build Settings to make sure the level you want to load is in the list of Scenes to Build.
Beyond that, I'd check that isQuit is set to false on your Start Level object.
Answer by DragonRapide · Feb 10, 2012 at 01:12 PM
yes but all that works. the Application.LoadLevel("Level01") is just for the start game button. But I want to know how to make a new button that change the text on the menu, so to say.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
My save function saves the wrong values!! 1 Answer
Load another Scene after collecting 6 coins 1 Answer
How to use StreamReader in my case 1 Answer