- Home /
World space buttons and preventing UI touch passthrough
Suppose you have several world space canvas buttons, and you want to make sure that the buttons that are behind the others are not triggered when the one immediately in front of the user's camera perspective...
Is there a way to have UI touches not pass through after hitting on UI element?
(I've tried IsPointerOverGameObject, but that doesn't seem to work for disabling specific UI gameobjects)
The functionality you're requesting is there by default.
UI elements do consume mouse events by default, and the foremost element is the one which receives the event. I tested this with a world-space canvas and two overlapping buttons; only the foremost received any events.
Are you using a mouse or touches? I can't imagine why that should matter, but I can only test with a mouse. $$anonymous$$aybe it's a touch-specific problem.