I have a game object with the following script for example:
public class ExampleClass : MonoBehaviour {
public Renderer rend;
void Start() {
rend = GetComponent<Renderer>();
}
void OnMouseEnter() {
rend.material.color = Color.red;
}
void OnMouseExit() {
rend.material.color = Color.white;
}
}
In other script I handle this game object disabling or enabling it. The problem is when I disable it and the mouse is away of the game object, if I enable it again and now the mouse is on the object, in this situation the OnMouseEnter event will never be called. It only will be called if I exit and enter again. How to solve that, I have to use OnMouseOver just to check this?