Purpose: optional dynamic UI view layer for Shop.
Use one Shop for purchase logic, save data, currency, ownership, and inventory events. Add one or more ShopListView components when you need separate category views, tabs, filtered lists, or a fully spawned storefront.
- Put
Shopin the scene and assign allShopItemDataassets. - Disable
Auto Spawn ItemsonShopif the shop should not create its own full list. - Add
ShopListViewto a UI root. - Assign the same
Shop, anItem Prefab, and anItems Root. - Call
ShowCategory(string)from category buttons, orShowAll()for the full list.
| Field | Purpose |
|---|---|
Shop |
Source shop controller. Auto-resolved from parent/scene when empty. |
Category |
Current category filter. |
Show All When Category Empty |
Empty category means all items instead of only uncategorized items. |
Include Owned / Include Unowned |
Basic ownership filters. |
Hide Owned Single Purchase Items |
Removes already owned one-time items from the list. |
Item Prefab |
ShopItem prefab used to spawn missing views. |
Views |
Optional pre-authored views reused before spawning more. |
Button Action |
What ShopItem.buttonBuy does: buy, preview, or select. |
ShowAll()ShowCategory(string category)SetCategory(string category)SetIncludeOwned(bool)SetIncludeUnowned(bool)SetButtonAction(ShopListButtonAction)SetItemPrefab(ShopItem)SetItemsRoot(Transform)SetShowAllWhenCategoryEmpty(bool)SetHideOwnedSinglePurchaseItems(bool)Refresh()
For most projects, use one Shop and multiple ShopListView instances instead of one Shop per category.
If UnityEvent string parameters are inconvenient, add ShopCategoryButton to a UI Button.
- Assign
Target View. - Set
Categoryor enableShow All. - Leave
Auto Bind Buttonenabled.
At runtime the button calls ShopListView.ShowCategory(...) or ShopListView.ShowAll().