# OnPointerClick not being called

I implemented the IPointerClickHandler in a script that runs on multiple GameObjects in my scene. I'm definitely missing something since the implementation is not being called at all. The objects are not UI elements. Here is the implementation of the interface :

 public void OnPointerClick(PointerEventData eventData)
{
Debug.Log("clicked on " + eventData.selectedObject.name);
}


Can I even use the EventSystem with normal GameObjects? If I can how do I do it.

What i tried: Adding a BoxCollider2D to the object, using the event trigger component on the object calling a public method.

Edit: I was missing a raycaster on the main camera.

• Don't answer your questions inside the question body. Post your answer instead as an answer, so that others can find the help too.
– user35344
May 3 '16 at 8:34
• @Tyyppi_77 yeah again sorry about this. I just got to work after a 4 day weekend and I'm not in the zone so to say :D May 3 '16 at 8:51

## 1 Answer

Turns out i was simply missing a RayCaster component attached to my main camera. In my case I had to use the Physics 2D Raycaster.