How to get mouse inputs on child object

I have a simple problem: I need a way to get MouseOver and Pointer inputs on an object that is a child of a prefab. By default, these events will only trigger on the parent object.

I would like to be able to define certain areas of the prefab that register mouse events to the parent and other areas that allow events to pass through to the children.

I could use a script to check if the cursor is in a predefined area and then manually handle mouse events, but surely there must be a less hacky way to do this, right? Is there a way to resize the parent’s collider?

I ended up having to manually handle all mouse inputs on this prefab in OnPointerMove to check the cursor position and determine which object to trigger on.

This seems like a pretty common thing you’d want to do - does the input system really not support this?

1 Like