OnPointerClick not working, others events yes

I use

publicoverridevoid OnPointerClick(PointerEventData data)
{
Debug.Log(“OnPointerClick called.”);
}

And it doesnt work, but others like OnPointerEnter work fine. Thought maybe the element needs a button component , i added it and doesnt work either, added it to its child a button component too and doesnt work.

If you are trying to implement the interface, you need to use the IPointerClickHandler interface.

Then just implement it. No need to override.

 public void OnPointerClick(PointerEventData eventData)
    {

    }

i was already using that, i knew i didnt need override just copied from EventTrigger example in unity docs, solved the problem, it was cause i didnt have to put any button component, it works now

1 Like

I’m having an issue where it works sometimes and then it doesn’t…I have a prefab of a coin and it drops and falls down the canvas you have to click the coins to recieve the coinsperclick but when the coins are falling fast it doesn’t detect…so not sure what to do

Dont understand what you mean