OnMouseOver don't work

The Function don’t work on my RawImage Object

void OnMouseOver()
	{
		Debug.LogError(gameObject.name);
	}

I tried everything I saw on the forum but I don’t know why nothing work :s
Here my object:
81126-ss2016-10-28at082807.png

I tried with that component :

81127-ss1.png

and with the 2d components too but I can’t find why nothing work…

Thanks.

Try to make your script implementing the IPointerEnterHandler interface :

public class MyClass : MonoBehaviour, IPointerEnterHandler
{
      private void OnPointerEnter(EventSystems.PointerEventData eventData)
      {
             Debug.LogError(gameObject.name);
      }
}

If you read the manual, (here) the OnMouseOver also has a special setting for GUI elements, which you are using. Since the Canvas is in the UI layer, I reccomend you don’t try to use colliders :slight_smile: