Inventory Manager
Last updated
Last updated
The Asset Layer SDK includes an inventory manager ready to use out of the box. It offers various options for users to select assets. By default, users begin by viewing all slots of your app, then filter down to the assets they wish to use.
You can find the Inventory prefab in Assets/AssetLayerUnitySDK/Prefabs. To add the inventory manager to your scene, simply drag the prefab into your scene.
By default, the inventory menu in the scene is toggled by pressing 'i'. To open the inventory through other methods, call the ToggleInventory
function of the InventoryManagerUnityUI
, for example, from a button as illustrated below.
Furthermore, you can customize the toggle key by selecting the 'ToggleKey' option. You can also completely disable key-based toggling by turning off the 'Use Toggle Key' option in the Inventory Script.
An additional simple method to toggle the inventory is to assign a GameObject with a Button component to the ToggleElement
field in the InventoryUIManagerUnityUI
script on the Inventory prefab. This automatically enables the button to toggle the inventory on and off.
To configure your Inventory, you can set the following fields.
Menu Name: This will set the title of the inventory manager in your scene.
Slot Id: Allows specifying a particular slot for automatic selection at startup.
Display All: When enabled with a slot ID specified, users see all assets in that slot immediately, bypassing the need for filtering across collections. Slot Ids: For user selection from multiple slots, filter the slots IDs they can select from here by specifiying the ones the can select from. Users choose a slot, then a collection where they own assets, and finally select an individual asset.
Auto Select: With 'Auto Select' enabled, 'Display All' active, and no prior asset selection, it automatically chooses an asset for the user at startup. This is useful for immediate gameplay with a default character, allowing users to later switch to other assets.
Close On Selection: When disabled, the inventory remains open after an asset is selected.
Asset Expression Id: Defines the Expression Id to load from the selected assets. If unset, an appropriate expression type is automatically chosen.
Methods to be executed upon the selection of an asset can be assigned through the 'On Asset Selection' field. This is automatically assigned by the AssetLayerGameObject prefab, so there's no need to set this unless you have specific logic you wish to execute.