Trouble with scroll rect.

Hey guys, i have a project with a scroll rect that has buttons in the content.
I’d like to be able to scroll the content wherever you touch, be able to drag the view on the whole.
How it is right now i can drag the view only on the portions that don’t have a button.
If i drag on the place of a button, it won’t drag.
I tried doing a on begin drag, disable raycast target on the button, hoping that it would catch rect and scroll it, but it didn’t work.

The standard scrollrect should be able to handle moving the scrollrect content if if it contains buttons. Was testing that yesterday for the upcoming UI Extensions update.

If you want to “drag” a button out of the scrollrect, then we added a reorderable list component in the last update which supports that

No, just have a clickable button, that the user is still able to scroll the view if they start dragging on it instead of pushing it.
I’m using the Pointer click on the button.

When you say that you are using the “Pointer click” do you mean you are using a component that implements IPointerClickHandler or are you using the OnClick UnityEvent for the button?

If you are using the UnityEvent approach, the system should not invoke the OnClick event if the scroll view is moved. I’d have to look at the source, but I am fairly certain that this is due to the change in pointer coordinates during the scroll. However, if you are using the IPointerClick handler approach, I’m fairly certain you would have to implement the checks for that yourself.


Event trigger… there was a reason why i didn’t implement a button, don’t remember why at the moment.
I’ll try with the UI button again instead of a component. I honestly thought they would behave the same, like the button was just an object with a component.

edit I think i remember. it was because i the image i had for the button was square but the button needs to be rectangular. So if i didn’t use an image, the button wouldn’t work as there was nothing to raycast against i think. No image.

Yes, you are correct guys. it works fine now, thanks.

1 Like

EventTrigger!!! #MyEyes :stuck_out_tongue:

1 Like

I’M SORRY OKEY!?!
I was young and stupid… :stuck_out_tongue:

1 Like