How to add onPointerDown event on SpritRenderer GameObject

I need to add onPOinterDown event to a spritrenderer .

Its work properly on ui game object (like image , text etc.)

But i need to it for spritRenderer (for non ui game object)

The OnPointerDown event only works on ui elements. It doesn’t work on gameobjects. To do the same with gameobjects its best to do it by raycasting.

If i remeber well… you can add a collider to that object, and use

void OnMouseOver()

That will be executed once the mouse is over the object. And

void OnMouseExit()

you knwo wht does :smiley:

Bye!