Swipe to scroll in grid

bitmore

Member
Hi,
Can I use a "mobile" way to scroll the inventory grid?
I'm working on a mobile game so I want the player can swipe to scroll the scroll view and load more items.
I have extended the ItemViewSlot to fix the conflict between the click event and the drag event. Now my scroll view can scroll by swipe but can't load more items when reaching the bottom of the scroll rect.

I have tried GridNavigatorWithScrollView and GridNavigatorWithScrollbar, but they both scroll by the scrollbar.
Any suggestions will be greatly appreciated!
 
I'm afraid that's not possible out of the box.

Our Grids work by recycling the ItemViewSlots as they scroll. So you have two options. Simply don't out grid navigator with scrolling ans instead use the Unity built-in scroll view. There are some advantages and disavantages to this.
The most notable disadvantage is if you have a lot of items, performance could drop, since all item view slots are spawned, and only hidden.
The advantage is that drag scroll would work automatically.

If that is not an option for you then the last option is to make your own custom GridNavigator. You'll need to send the scroll amount change made by drag scrolling to the scroll bar such that it can update the item view slots to show.

I hope that helps
 
Top