OnMouseOver tags Trouble(Solved)

ok so simple i want an objects renderer to enable and disable when I but the mouse over an enemy but I’ve made a mistake and cant find the solution.

the code i’m using is

public var reticuleInner : Transform;

function OnMouseOver (enemies : Collider)
{
	Debug.Log ("ding");
	if (enemies.gameObject.tag == "Enemy")
	{
		Debug.Log ("dingding");
		reticuleInner.renderer.enabled = true;
		reticuleInner.transform.Rotate(0,targetingRotateSpeed*Time.deltaTime,0);
	}
	else
	{
		reticuleInner.renderer.enabled = false;
	}
}

I get niether “ding” nor “dingding” in the debug log
its driving me nuts.
And there’s no compile errors to work from

can anybody see the mistake? :evil:

OnMouseOver is a function triggered on a gameObject when the mouse is over it. In order to trigger, the gameObject must be a GUI Element or have a collider.

Is that script on the elements that should react ? I highly doubt it.

so if I place a script using OnMouseOver on the game object (Enemy) that calls a function in this script to enable and disable the component then i’ll get the thing to work.

correct?

Correct.

(I think…)

i’ve tested it internaly by adding a getkeydown to call the function DynamicReticule.
this gives the desired effect butits yet to be seen if the sendmessage works as expected from the enemy object using OnMouseOver and OnMouseExit :smile:

Edit: Yup it works