LoopScrollRect recycles cells, and a negative Total Count means the list never ends
These scripts will make your UGUI ScrollRect reusing cells, to improve performance, loading time and draw calls.
At a glance
- What is it?
- A Unity package that makes a ScrollRect build only the cells it needs, with three interfaces for prefabs, data and size, and an inspector that counts backwards to mean infinity. The documentation is thin, the Chinese version lives in a blog post from 2015, and only one of the three demo scenes is registered as a sample.
- Who is it for?
- LoopScrollRect suits a Unity project with a long list in a scroll view, on a version from 2019.4 onwards, where cell construction is the cost you want to remove and you are willing to implement two interfaces and accept one method on the cell. It does not suit a project that needs variable height cells without also implementing the size helper, or one that wants a documented API beyond the inspector fields.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 7 days ago.
- What is it written in?
- Mainly C#, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- qiankanglai/LoopScrollRect2,784 ★ · +11
| Repository | 2026-09-30 | 2026-11-15 |
|---|---|---|
| qiankanglai/LoopScrollRect | 2.8k | 2.8k |
11 Stars in the last 46 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
A negative Total Count is how the inspector spells infinite
The inspector exposes the two settings that decide whether the loop behaves, and the first one has a convention worth knowing before you touch it. Total Count is how many cells there are in total, and a negative number means infinity. That is the whole mechanism for an unbounded list: you do not pass a large sentinel value, you pass a negative one, and the scroll rect keeps building cells as the viewport moves.
The second setting is directional. Reverse Direction exists for lists that scroll from bottom to top in the vertical case, or right to left in the horizontal case. Enabling it is not sufficient on its own, because the documentation pairs it with a second manual step: adjust the content's pivot and anchor. So reversing direction is half inspector toggle and half layout configuration, and the half you skip produces a list that appears to scroll the wrong way.
Both are exposed as fields rather than only as API, and the documentation is explicit that they exist so you can try the component out without writing an interface implementation first.
Refresh updates data and leaves layout alone, Refill recomputes it
Four operations sit in the basic usage group, and the difference between them is the difference between a cheap update and a full relayout.
`Clear` removes existing items and sets the total count to zero. `Refresh` refreshes existing items without affecting layout, and the documentation adds that all cells only get their data updated, with the reason given as performance. `Refill` clears and refills from the start with the layout recalculated fully. `RefillFromEnd` does the same from the other end, also with a full relayout.
So if your data changed but the geometry did not, `Refresh` is the operation you want, and the reason the API is split this way is that recalculating a large list's layout is exactly the cost this package exists to avoid. If items were inserted or removed, or sizes changed, you are in `Refill` or `RefillFromEnd` territory.
Two further groups exist for testing scroll position. The refill test group gives you `GetFirstItem`, which reports the first visible item index and offset, and a `Refill` overload that refills from the start using a specified first item and offset. The from end group mirrors it with `GetLastItem` and a matching `RefillFromEnd`.
Three interfaces, and the cache pool is a recommendation not a rule
The integration surface is three interfaces. `LoopScrollPrefabSource` provides the different cells, and the documentation says implementing it is highly recommended together with using a cache pool. `LoopScrollDataSource` provides the data for a specified cell. `LoopScrollSizeHelper` provides precise cell sizes, and the documentation points you at `SizeHelper.cs` as the example when your cells are not all the same size.
That third one is the condition to check first. Variable size cells are the case where a recycling list is hardest to get right, because the scroll rect has to know the height of something it has not built yet. If your rows are fixed height you can skip the helper entirely; if they are not, skipping it is the decision that produces a list that scrolls to the wrong position.
The cache pool wording is worth reading carefully. It is a recommendation attached to the prefab source interface rather than a requirement, so nothing stops you from generating a prefab per index. The performance argument the package makes, about loading time, draw calls, and memory, is an argument about construction cost, and a pool is the mechanism; implementing the interface without one keeps the recycling and gives up the construction saving.
Beyond the interfaces, the inspector fields are described as being there so you can test without implementing anything.
Each cell needs a Layout Element and a method taking one index
The cell side of the contract has two requirements and neither is optional. The cell needs a preferred width and height set in its layout properties, because that is what the loop uses when it calculates layout. The easiest way to supply them is to attach a `Layout Element` component and set the preferred width and height there.
Second, the cell needs a script attached that receives a method taking a single integer index, spelled `void ScrollCellIndex (int idx)`. That method is how the loop tells an existing cell which item it is now standing in for, which is the whole point of recycling: the object persists and its contents change.
The two requirements together are what make the scheme work. Layout cannot be computed for a cell whose size is unknown, and a cell that cannot be told its index cannot be reused for a different row. A cell missing the layout element will still scroll, but the positions will be wrong in a way that is easier to misdiagnose as a layout group problem than as a missing component.
The simplest end to end usage is pointed at a specific file, `InitOnStart.cs`, and the three demo scenes cover the cases the API has: the basic scene, a more complex multi cell example, and a scene that tests scroll rects which are not fully filled.
The manifest pins Unity 2019.4 and an ssh repository URL
The package manifest is short and every field in it constrains something. The Unity version field reads `2019.4`, which is the floor: the package declares itself against the 2019.4 line of the editor. The single dependency is `com.unity.ugui` at `1.0.0`, so the package builds on Unity's own UI system rather than replacing it.
The repository field is the one that catches people. It is an ssh URL, `ssh://[email protected]:qiankanglai/LoopScrollRect.git`, rather than the https form. That works for a clone from a machine with keys, and it is a different shape from what most registry tooling expects to find, so tooling that reads the manifest rather than your git remote can behave differently from your own workflow.
The package name is scoped, `me.qiankanglai.loopscrollrect`, the display name is LoopScrollRect, and the keywords array contains exactly one entry, `UGUI`. The description field is the shortest possible statement of the purpose, in the imperative: make your ScrollRect reusable.
The author field names Kanglai Qian with an email address and the same personal site the documentation points at.
One sample is registered and three demo scenes are named
The manifest registers a single sample, displayed as Demo, described as containing several Loop Scroll demos, at the path `Samples~/Demo`. The documentation, by contrast, names three scenes to look at: the main demo scene for a quick start, a more complex multi cell example, and a single scene variant that tests scroll rects which are not fully filled.
So the sample you get from the package manager is a folder called Demo, and the file names inside it are described in prose rather than enumerated. If you are looking for the exact scene that covers your case, the documentation tells you which behaviour each one tests rather than where each one lives.
Two directory names in the tree carry a trailing tilde, `Images~` and `Samples~`. That suffix is how Unity is told to leave a directory alone: it is not imported, so documentation images and sample projects sit in the package without becoming part of the consuming project's build. The package is otherwise laid out as a Unity package expects, with an `Editor/` folder, a `Runtime/` folder, and a meta file committed next to each of them.
Meta files are also committed for the manifest, the readme, the licence, and the changelog, which is unusual to see for text files and means the Unity asset database has stable identifiers for them.
The documentation home is a blog post from 2015
The project description and the documentation both point at a single URL, a post on the author's personal site dated 2015-08-15. That post is where the Chinese-language explanation lives, and the English README says so and links to it. So the two language versions are not side by side in this repository; one of them is on a blog.
The consequence is that the README is the only maintained documentation in the tree, and it is under a page of prose. There is no separate documentation site, no API reference, and no wiki linked from the package manifest. The two documentation URLs the manifest does carry both point back at files in this repository, the readme and the licence.
The changelog is a file at the root, and the releases are ordinary patch releases with no pre-release suffix: 1.1.3 in February 2025, 1.1.4 in July 2025, and 1.1.5 in January 2026, which is the version the manifest declares. The branch was last pushed on 2026-10-02.
For a package with this little documentation, the changelog file is worth more attention than it would be in a larger project, since it is the only place that records what changed between the versions you might pin.
Editorial conclusion
LoopScrollRect suits a Unity project with a long list in a scroll view, on a version from 2019.4 onwards, where cell construction is the cost you want to remove and you are willing to implement two interfaces and accept one method on the cell. It does not suit a project that needs variable height cells without also implementing the size helper, or one that wants a documented API beyond the inspector fields. Before you install it, check three things: whether your Unity version is at or above the manifest's 2019.4 floor, whether you can describe your list size as a number or as unbounded, since that choice changes how scroll-to-item behaves, and whether the operations you actually need are Refill, which recalculates layout, or Refresh, which deliberately does not.
Frequently asked questions
What is LoopScrollRect and what problem does it solve?
A Unity package that makes a ScrollRect reusable, so it builds cells only when they are needed instead of building every row up front. The project states it saves loading time and draw calls along with memory in use, while still scrolling smoothly, and its intended case is a scroll rect holding a large number of cells.
How do I install LoopScrollRect in a Unity project?
Two ways. With OpenUPM, run openupm add me.qiankanglai.loopscrollrect, or in the Unity Package Manager add the package from the git URL https://github.com/qiankanglai/LoopScrollRect.git. The package declares Unity 2019.4 as its editor version and depends on com.unity.ugui at 1.0.0.
What interfaces do I have to implement to use LoopScrollRect?
LoopScrollPrefabSource to supply the different cells, which the documentation pairs with using a cache pool, and LoopScrollDataSource to supply the data for a specified cell. If your cells have different sizes you also implement LoopScrollSizeHelper, with SizeHelper.cs given as the example. Each cell additionally needs a preferred width and height in its layout properties and a script receiving an index.
What is the difference between Refresh and Refill in LoopScrollRect?
Refresh updates existing items without affecting layout, with all cells only getting their data updated, and the documentation gives performance as the reason. Refill clears and refills from the start with the layout recalculated fully, and RefillFromEnd does the same from the other end. Use Refresh when only the data changed and a refill when the geometry did.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/qiankanglai-loopscrollrect)Star history chart for your README
[](https://hysenlabs.com/projects/qiankanglai-loopscrollrect)Was this useful?