When my mouse is over text, it should change it’s color. I made a script (copied from the OnMouseEnter() documentation) but it just won’t work. I attached a Collider to my Text.
The following code is not working:
using UnityEngine;
using System.Collections;
public class TextHandler : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseEnter() {
renderer.material.color = Color.red;
}
}
What did I do wrong?
It's a 3d text gameobject, not GUIText. I found the problem: a collider was blocking the text!
– rocket350