Create and Add Item Asset
It is very easy to create and add new Items to the Inventory.
Add Item Asset
Navigate in the Project view into the folder Scripts/ItemAssets and right mouse click on the folder or inside the content space.
In the context menu you have the option “Inventory System” und create. Choose “Inventory System –> Items –>Item” and give the item a cool name.
Click on the the Item and in the inspector the ItemObject with its attributes is shown. Click on the UIDisplay and choose an icon for the new ItemObject.
Then fill in the category, the type and descritption.
Now open up the data section of the Item
Fill in the following attributes:
- Name: The name which will be displayed in UI
- Id: This id will be set automatically by adding it to the database later (leave it for now at -1)
- Coins: This is the amount of coins the item is worth
- Buffs: Attributes that will be increased when wearing this item (multiple entries)
- Attribute: The attribute type
- Value: Value will be generated randomly out of min and max at pickup
- Time For Max Value: If this value is greater than 0, the value should be applied over time
- Min: Minimal value
- Max: Maximal value
- Requirements: Requirements to wear this Item
- Attribute: Attribute that is required (multiple entries)
- Value: Value of the required attribute
- Stackable: When stackable all of the same type will be stacked automatically
Add Item Asset to Database
Navigate in the Project to the Folder “Scripts –> InventoryAssets” and select the Datbase Scriptable Object. On the top right click on the lock symbol to lock the view on this item.
Choose the + Symbol in the list and drag the new Item into the database.
Click on the lock again and look into your newly created Item. The new ID should be set automatically.
Add Item Asset as Loot
To pickup the Loot and look if it’s working, you need to add it to the Loot Items in the scene. For that open the scene “InventoryPlayground” and copy one of the loot beams in the “Loot” object.
If you click on the object you see, that there is a NononGroundItem added to the object. Drag the new ring to the Item attribute.
Now run the game and pickup your new ring.