- Home /
Question by
Angellify · Aug 16, 2014 at 11:55 PM ·
OnMouseEnter, change color.
Hello guys. So, I'm just playing around in Unity (god, it's so fun when you know even the tiniest bit of scripting), so I was trying to make a main menu. I usually just go with GUI.Button which is great but this time I wanted to make it different, based OnMouseEnter, so I looked it up, searched a bit, somebody said that I will need to use "OnMouseExit, OnMouseDown" and so, which is like GetButtonDown, I think , at least for me.
Anyways, here is the script.
public class mainMenu : MonoBehaviour {
void OnMouseEnter ()
{
renderer.material.color = Color.red;
}
void OnMouseExit ()
{
renderer.material.color = Color.black;
}
void OnMouseDown ()
{
Application.LoadLevel (1);
}
}
Now, there is nothing wrong with the code, true but when my mouse gets on the 3D Text, the color is not changing, why?
Yes, there is a collider with the box "On Trigger" checked.
Comment