Detect UI Panel click

Hi, i’m try to detect a click directly on Panel, i tried everything that i know, like currentSelectedGameObject of EventSystem, PointerClickHandler… but i got unsuccessful attempts. And my Panel are instanced to my GameObject/Script(the script is a Component of the GameObject).

I’m try this correctly ? 'Cause another objects i can detect perfectly, like Button. Only the Panel i can’t.

Just add a button component to the object. Then plug your function into the button component

I know I’m really late, but I just thought I’d share this for anyone coming across this thread.

There’s another way I prefer, which not only lets you click, but detect ANYTHING. It’s the Event Trigger component. It can detect anything a mouse can do to the UI, not only a panel, but text, image, etc.

The Button component can only change the color of the panel when hovered over (as to my knowledge), but with Event Trigger, you can do whatever you want with it, improving the audio/visual Feedback of your project. You can also detect scrolls, drags, selects (idk), and more.

Hope this helps :slight_smile:

same problem