How to consume uGUI events?

Hi,

I have a few buttons in my scene with Unity’s own uGui. Problem is when I press those buttons, game also gets those events and reacts unexpectedly.

How can I make buttons to “consume”, so to say, so when they get the click event, it won’t propagate to other components as well.

Thanks.

if you have buttons above your GameObjects in scene and you want to separate touch events from Gameobjects and buttons you can use : EventSystem.current.IsPointerOverGameObject() It will return bool.