- Home /
Help? Problem with GUI Text button.
Hello. I have posted a previous similar question but with no replys. PLEASE PLEASE HELP! I need to know how to make a proper GUI Text button for my Main Menu of my game. The only problem I've had is that....my script says that if I click on this gameobject...then Level 1 should load. My problem is that whenever I click ANYWHERE on the screen, it starts level 1. I drag the script and drop it on the Start Button but to no avail. It results in the same thing. Anywhere I click, it starts the Level 1. Help? I only need it to start Level 1 when I click the start button. Here is my script..
function Start() { }
function Update()
{
if (Input.GetMouseButton(0))
{
print ("works") ;
Application.LoadLevel("test") ;
}
}
Answer by DaveA · Nov 01, 2012 at 09:50 PM
Your script looks like all it does it look for a mouse down (anywhere) and load level "test"
if you want this to happen on a GUI text button:
function OnGUI()
{
if (GUI.Button (Rect (10,10, 100, 20), "Click me to go to level test"))
Appliation.LoadLevel ("test");
}
won't this create a GUI button? I just want to click on a 3d GUI text and be able to load a level.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Click Goes Everywhere 0 Answers
GUI Texture overlap Click/Tap 1 Answer
How to make unity expect a click 0 Answers
Incorrect button event positioning 0 Answers