- Home /
Making scrollview single-direction while allow dragging parent in other diration
I have two of scrollviews, like this:
RootScrollView (Vertical only)
|-> RootScrollview Content
|-> Label
|-> SubScrollView (Horizontal only) 1
|-> SubScrollView (Horizontal only) 2
When dragging, sub scrollview is dragged horizontally as expected.
But the root scollview won't be dragged vertically. It seems that vertical input is intercepted by sub scrollview.
How to make them be dragged at the same time? Or is there a method that helps me determine which should be dragged, and simulate the draging operation?
Answer by xxmariofer · Sep 03, 2021 at 07:49 AM
thats not supported by unity. The subscrollview will "intercept" the input, my suggestion is to use a scheme similar to this:
the green squares are the sub-scrollviews, (dont fit the full witdth of the parent scroll view) and leave in the right a bar to scroll the parent scroll view (the orange is the label)
Answer by Eno-Khaon · Sep 03, 2021 at 08:47 AM
I came across a resource for this a while back that specifically works up to version 2018.4. I haven't looked into an updated variant for newer versions, but this specifically determines the direction of the drag and uses the scrollview that matches the alignment of your motion.