If statement mouse over object

I can’t use OnMouseEnter / Exit for some reasons

could you give us the code? so we can try to help you fix it?

According to the documentation OnMouseEnter() and OnMouseExit() is called on objects with either a Collider or a GUIElement. Did you remember to add one of them to the gameobject that’s using your script?


MonoBehaviour.OnMouseEnter() (Unity - Scripting API: MonoBehaviour.OnMouseEnter())

Called when the mouse enters the GUIElement or Collider.


MonoBehaviour.OnMouseExit() (Unity - Scripting API: MonoBehaviour.OnMouseExit())

Called when the mouse is not any longer over the GUIElement or Collider.