Can OnPointerEnter be triggered from another UI object?

Hi, recently I needed certain things to happen only when clicking on a different part of UI. So I had to make a separate script for that particular UI element and delegate OnPointer functions to other objects.

Is there a way to avoid doing this and trigger OnPointerEnter when mouse is over different game object? Also same question about OnTriggerEnter/Exit methods. Can the collider that triggers them, be on a separate object?

From what I’ve searched the answer is NO, but maybe there’s something I’m missing.

For the UI there’s a component called EventTrigger. You can assign any object you want to it.

For colliders, the answer the No.

Like you were doing, make a generic script to pass the events you want. You could expose the event as a UnityEvent so you could subscribe your other scripts from the Inspector (just like EventTrigger).

1 Like

Thanks, somehow I missed this.