https://github.com/son24tuoi/recyclable-scroll-unity.git


The scroll system optimizes performance by reusing UI elements (GameObjects). Instead of creating thousands of objects that consume RAM and slow down CPU processing, this system maintains only a small number of elements sufficient to display on the screen and updates their data as the screen is scrolled.
| 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 |
pageIndex variable to control data boundaries.RecyclableScrollVertical.cs / RecyclableScrollHorizontal.cs script to the GameObject containing the ScrollRect (you can place it elsewhere too 😅).ScrollRect and ContentRT variables for RecyclableScrollVertical.cs / RecyclableScrollHorizontal.cs onto the Inspector window. Set the maximum number of list items to display in TotalItems (or set it via code). Other variables visible in the Inspector will update automatically.RecyclableScrollVertical.cs / RecyclableScrollHorizontal.cs using the Init() function with a callback function as a parameter to update the data. See the sample script ItemLoader.cs and the sample scene Scene_RecyclableScroll inSamples.