Question about eventtriggers inside scroll rects

I have a scrollrect, and it has some content inside it. specifically a handful of UI.Text objects.

Everything is generated at runtime, the text objects are prefabs and they get created and sized properly and childed to the scrollrect content canvas.

It is all laying out fine and resizing and the scrolling works great: I can drag and scroll, I can use the mouse wheel and scroll and the scrollbars work, everything is working as I would expect.

Until…

I add an event trigger to the text objects. I want to be able to click on a text object to trigger some stuff. When I add the evert trigger with a pointerclick event to the text objects, then everything still lays out fine, and I can click on the text objects and those events get called, but I can no longer drag the scrollrect or use the mouse wheel to scroll. The scrollbars still work though.

I presume that my event triggers are intercepting the drag events and so they are not getting to the scrollrect. Is there something that I am missing to be able to have interactable objects inside a scrollrect?

Thanks!
Ben

1 Like

I should also maybe add that I am using 4.6b20

1 Like

It’s happening in Release 4.6.0 !!

Hi. So the reason this is happening is that the EventTrigger eats all events that are sent to it. we really don’t recommend using the trigger outside of prototyping. What you want to do is have your own custom MonoBehaviour that implements JUST the interfaces that you wish to receive events for.
The ones that the modules support out of the box can be found here:
https://bitbucket.org/Unity-Technologies/ui/src/b914129e0b5bc9e9eb20af391ba99f659ec85a47/UnityEngine.UI/EventSystem/EventInterfaces.cs?at=4.6