Allows users to scroll through content and loop infinitely when reaching the end of the list.
The scroll system optimizes performance by reusing UI elements (GameObjects). Instead of instantiating thousands of objects—which consumes RAM and slows down CPU processing—this system maintains only a small number of elements sufficient to display on the screen and updates their data as the user scrolls.
- High Performance: Only creates the minimum number of objects necessary to fill the viewport.
- Support for large datasets: Can display lists of up to thousands of items without increasing resource consumption.
- Easy integration: Based on Unity UI’s standard ScrollRect, the source code can be customized to suit individual preferences.
| Criteria | Traditional Scroll | Reusable Scroll |
|---|---|---|
| Number of Objects | Equal to the total amount of data → the more data, the more objects. | Fixed, typically twice the number visible in the viewport. |
| RAM usage | Increases gradually with data | Low and stable |
- Pagination: Uses the
pageIndexvariable to control the data boundary. - Scrolling: When content reaches the edge of the viewport , it is moved to the appropriate position to allow further scrolling (while updating the displayed data).
-
Attach the
CircularScrollVertical.cs/CircularScrollHorizontal.csscript to GameObject containing ScrollRect (you can place it elsewhere too 😅). -
Drag the
ScrollRectandContentRTvariables forCircularScrollVertical.cs/CircularScrollHorizontal.csonto the Inspector window. Set the maximum number of list items to display inTotalItems(or set it via code). Other variables displayed in the Inspector will update automatically. -
Configure the UI items in the list as child objects of the Content game object (make sure there are just enough to fill the viewport)
-
Configure
CircularScrollVertical.cs/CircularScrollHorizontal.csusing theInit()function with a callback function as a parameter to update data. See the sample scriptItemLoader.csand the sample scene Scene_CircularScroll. -
Retrieve the list of UI items in Content using the
TryGetComponentsInContentChildren()function. See the sample scriptItemLoader.csand the sample scene Scene_CircularScroll.

