Unity-UI-Extensions/com.unity.uiextensions

Trouble with Infinite Scroll Rect

Opened this issue · 4 comments

Issue created by Dylan Daniels as Bitbucket Issue #​395 on 2022.01.14 03:52.
Hey! First of all I want to say great job with this project. I have downloaded and am using the infinite scroll rect script on a gridlayout group. It does work, but I want the first objects in the layout group to move to the back when they are off screen and vice versa. The problem is changing any of the values makes them flicker, and still not have the desired effect. I know it’s nothing major, but I would really appreicate any advice you guys could give me to achieve what I want :slight_smile:

On 2022.01.14 04:01, Dylan Daniels commented:

I basically need the things on the right hand side of the screen to be directly behind the ones on the left, and I need them to split much earlier so it is a constant scroll of objects and with no space between.

On 2022.01.17 11:54, @SimonDarksideJ commented:
Interesting use, I personally haven’t tried the infinite scroll with the Grid layout, but will see if there is anything that can be done to improve it’s use.

Can you provide an example scene just using the UI Extension and Unity controls to test out your combination on please?

On 2022.01.17 21:26 Dylan Daniels modified issue:
attachment changed /UnityUIExtensions/unity-ui-extensions/issues/attachments/395/UnityUIExtensions/unity-ui-extensions/1642454803.91/395/IniniteScrollRectTestExport.unitypackageIniniteScrollRectTestExport.unitypackage

On 2022.01.17 21:26, Dylan Daniels commented:
Hey @{557058:da9b1be2-6172-44a5-a085-cae5d30eda9e} ! Yeah of course. I quickly threw this scene together before work, for what ever reason I couldn't get the standard scroll rect working, but I'm sure it's something trivial.

As for what modifications I've done, I'm checking the constraintCount on the gridlayout group and when deciding anchored position I am doing this:

c\# _newAnchoredPosition.x -= _itemCount * _recordOffsetX / _gridColumns;

which seems to work, but only if the contents of the gridlayout are an even size. (any gaps in the grid seem to mess it up.) The other task is preventing the contents from leaving the screen. (preventing any sort of scrolling.) I have tried simply moving it back once it’s released but then it messes up the “infinite” illusion of the scroll rect.

EDIT: I’ve had a look at it after work and it seems to only work correctly if the number of items is perfectly divisable by the gridcolumns.