[SOLVED] Can one produce tooltip-ish text near the cursor, using only one controller?

Here’s my code:

public class cursorController : MonoBehaviour {

	public GUIText cursorText;

	void Start () {
		cursorText.text = "";
	}

	void Update () {
		cursorText.transform.position = Camera.main.ScreenToViewportPoint(Input.mousePosition);
	}

	void OnMouseEnter (Collider other) {
		if (other.gameObject.tag == "pickup") cursorText.text = "A cube";	
	}
	
	
	void OnMouseExit (Collider other) {
		cursorText.text = "";
	}

}

This is built off the Roll-a-ball tutorial game (which by the way is excellent), so the cubes are properly tagged “pickup”.

What I want to do is for text to appear near the cursor when it’s over a cube, in the style of point-and-click adventure games. Initialising cursorText.text as a non-empty string reveals that the GUI text does work properly, but doesn’t switch to “A cube” when over a cube. I’ve tried a OnMouseEnter snippet within the cubes’ controller and it seems to work, thus I’m guessing I’m using OnMouseEnter/Exit the wrong way around. Nothing like that seems to turn up in the documentation.

'Course, the obvious alternative is to repeat the OnMouseEnter/Exit snippet in every item to be tagged, but I’m almost certain there’s a better way.

Use raycast:

void Update() {
    RaycastHit hit;
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    if (Physics.Raycast(ray,out hit 100))
    {
        if(hit.collider.tag == "Cube")
        // make tooltip show
    }   
}