- Home /
mouse enter Click problem
hey guys i have a problem my little program wil not work
here is the script
function OnMouseEnter(){
if (Input.GetButtonDown ("Fire1")) {
Application.LoadLevel ("SGC");
}
}
it should work right?
its for my main menu play button witch is a gui text but i want to change it to a litle plane in front of the camera with a texture that i have it says play and im gonna add a box collider on it. and i also gave the gui text a box collider but my textures are better than the fonts from unity so that way i wanted to do it with a plane and texture. i got it all reddy but the script wont load the level SGC and i have added it on the build settings. i have triad this it works it loads the level when i hover over the play buton but i want to be able to first click it than load
function OnMouseEnter(){
Application.LoadLevel ("SGC");
}
You can use the monoBehaviour function http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$onoBehaviour.On$$anonymous$$ouseUpAsButton.html>On$$anonymous$$ouseUpAsButton. It will load if you release the mouse over the same gui element it was clicked on.