This example scene is located in Assets/Plugins/Weaver/Examples/06 Meta Asset List. It demonstrates the use of a Meta Asset List to create a user interface that can display the details of its items without actually loading all the items into memory until they are needed.
ItemMetaDatacontains the details of an item (name, cost, description, etc.).Itemjust holds anItemMetaDatafield. It could have any other functionality, but all this example actually uses is the meta data.- Assets/Plugins/Weaver/Examples/06 Meta Asset List/All Items.asset is an Asset List. Specifically, an
ItemListwhich inherits fromMetaAssetList<Item, ItemMetaData>. It automatically gathers all prefabs with anItemcomponent in the target folder when entering play mode or compiling a runtime build so they can be accessed efficiently as a simple list at runtime. When doing so it also retrieves theItemMetaDataof eachItemand serializes that data alongside their resource paths so the meta-data of anItemcan be accessed without loading the actual prefab. ItemDisplayuses various UI components to show the details of anItem.- Note that everything will always show "Is Loaded" while in the Unity Editor, but they will only be loaded on demand in a runtime build. This ensures that the list always contains the correct references and data for the assets currently in the target directory while achieving the desired memory management at runtime.
ItemShopsimply initializes anItemDisplayfor eachItemin theItemList.- This example could be adapted to any scenario where you want to access certain details of objects without loading them upfront:
- A shop could use the item meta-data to sort and categorise entries, and only load ones that are currently visible.
- A shop for custom character skins could show a preview image of each without loading the fully detailed character models.
- An enemy spawning or loot drop system could act based on chance values in the meta-data.