{"id":13661907,"url":"https://github.com/sinbad/UnityRecyclingListView","last_synced_at":"2025-04-25T06:30:48.684Z","repository":{"id":139584290,"uuid":"212374760","full_name":"sinbad/UnityRecyclingListView","owner":"sinbad","description":"A fast scrolling list component for Unity UI which recycles its child elements","archived":true,"fork":false,"pushed_at":"2021-04-12T09:51:26.000Z","size":6992,"stargazers_count":182,"open_issues_count":0,"forks_count":22,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-10T17:45:21.397Z","etag":null,"topics":["ui-components","unity","unity3d"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinbad.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-10-02T15:21:03.000Z","updated_at":"2024-11-06T11:55:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f868919-44b8-4223-9c3f-c124fd761a9e","html_url":"https://github.com/sinbad/UnityRecyclingListView","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbad%2FUnityRecyclingListView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbad%2FUnityRecyclingListView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbad%2FUnityRecyclingListView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbad%2FUnityRecyclingListView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinbad","download_url":"https://codeload.github.com/sinbad/UnityRecyclingListView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250767009,"owners_count":21483906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ui-components","unity","unity3d"],"created_at":"2024-08-02T05:01:43.994Z","updated_at":"2025-04-25T06:30:43.669Z","avatar_url":"https://github.com/sinbad.png","language":"C#","readme":"\n# RecyclingListView for Unity\n\n\u003e #### Note: I have stopped using Unity and so am not maintaining this library any more.\n\n## What is this for?\n\nOne way of making a list is simply to create every item in the list and add it to\nthe content view of a Unity ScrollRect, perhaps with a ContentFitter to automatically\nexpand it, and a VerticalLayoutGroup to position them. There's one problem with\nthis: it gets *really* slow at high volumes.\n\nMost UI systems don't do this under the hood; instead they only allocate just enough\nvisual resources to cover the visible area (plus a safety area), and then\nrecycle the child views as you scroll - views which drop out of view are re-used\nfor the parts that are just coming into view. This way you have a fixed amount\nof overheads regardless of how big your list is. \n\nThis repo contains a smallest-possible implementation of this concept, sometimes\ncalled \"virtualising\" a list or just \"recycling\". Basically you keep the\n\"model\" which contains all of the data, and the list calls you back to ask you\nto provide details of a specific element when it needs it, because it's coming\ninto view.\n\n![Example Image](demo.gif)\n\n## How to use it\n\n\n### The Demo\n\nYou can drag this whole repo into Unity Assets to provide a \nquick demo of this so you can pick it apart yourself, just load *Scenes/RecyclingList*.\n\n### How it works\n\n* You have a list of items (just data, no view), this is your Model. This can be on any class.\n* You create a ScrollRect (Scroll View in the menu) and add a RecyclingListView to it\n* You create a prefab which is a child item in your list (the View item). It must have a component of RecyclingListViewItem on it.\n* You give the RecyclingListView a reference to that prefab; it pre-allocates them and keeps them in a pool\n* You set a delegate on RecyclingListView which is the method it calls when one of these\nitems needs populating with data\n* You simply tell the RecyclingListView the RowCount of your Model. It then calls the delegate for any of those items in view, giving you a row index to refer to.\n* You can tell the view that the model has been updated (without changing its size) via Refresh if need be (either completely or for a subset)\n\n\n### Step by step\n\n1. Create a Canvas\n2. Create a Scroll View underneath\n3. Tune how you like (I removed the horizontal scroll bar)\n4. Add RecyclingListView component to the scroll view\n5. Create a child panel which will go inside the scroll view, temporarily inside Content of scroll view (just so you can get it looking like you want)\n6. Create a subclass of RecyclingListViewItem to hold whatever data you need for this view\n6. Add your RecyclingListViewItem subclass as a component to the root of the child\n7. Make a prefab out of this child panel, then delete it from content\n8. Select the scroll view and set the Child Prefab on RecyclingListView to your prefab\n9. Create your component which will contain the model, somewhere. It doesn't matter where, so long as it has a reference to the RecyclingListView\n10. Your model component should set RecyclingListView.ItemCallback, and set RecyclingListView.RowCount. The rest will happen mostly automatically as \"How it works\" above.\n11. Change RowCount when you alter the length of the list, or Clear() and Refresh() to\n    empty or update content in-place.\n\n\n## Limitations\n\nThis is not a general purpose grid view like you'll find in the Asset Store, it's just\nfor lists. Specifically:\n\n* Only one type of child panel is supported\n* The child panel has to be a fixed height\n* Horizontal scrolling can still be used, but virtualisation is only done vertically\n\n## Tips\n\n### Pre-Allocate More Items\n\nThe list handles dynamic resizing, but if you know the max height your content \nview can ever be, and that's likely to be bigger than the default size, you can\navoid some reallocation by specifying that height in the \"Pre Alloc Height\"\nproperty on the list view component.\n\n## License (MIT)\n\nCopyright (c) 2019 Steve Streeting\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":["Open Source Packages","Open Source Repositories","C\\#"],"sub_categories":["UI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinbad%2FUnityRecyclingListView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinbad%2FUnityRecyclingListView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinbad%2FUnityRecyclingListView/lists"}