OnMouseDown

Im trying to get a print out of OnMouseUp/Down, OnMouseEnter/Exit none are printing anything… Am i suppose to do something special for these functions to work? I have the functions on all the GUI scripts in the game, i click hover over and whatever else i can think of, yet not a single print. The Objects who have the GUI scripts attached do no belong to Ignore Raycast Layer…I randomly got 1 print(after restarting Unity) when i started the game, no click in the editor. Im lost on this one.

On my main GUI script…

function OnMouseDown()
{
	overGUI=true;
	print("Down");
}

On a different GUI script

function OnMouseEnter()
{
	overGUI=true;
	print("Enter");
}

try something like this …

var normalTex : Texture2D;

var hoverTex : Texture2D;

function OnMouseEnter () {

guiTexture.texture = hoverTex;

}

function OnMouseExit(){

guiTexture.texture = normalTex;

}

function OnMouseDown(){

Debug.Log(“clicked”);

}

Don’t confuse GUIElement (GUIText, GUITexture) components with UnityGUI (OnGUI callback, GUI class, GUILayout class) these are two different things. OnMouseDown / Up / Enter / Exit works only for GameObjects with a GUIElement component attached. Those callbacks aren’t called for GUI controls created in OnGUI().