Items are very easy to create. You just need to add the “Item.cs” script to a game object and it becomes an item usable by the inventory system. Make sure that the item object has a collider component as well.
Edit the fields below to define the item.
- Item Drop Type: Choose whether you want to apply the drop type set in the Inventory Manager for this item or its own drop type (re-spawn or destroy).
- Item Type: 0 means a bag item, 1 means currency.
- Icon: The item’s icon.
- Min Distance: Minimum distance required between this item and the player object in order to pick up this item.
- Name: Item’s name. This is the name of the Item that is displayed and used in all the other inventory elements.
- Amount: The amount of this item type.
- Weight: The item’s weight.
- Is Stackable: Don’t check this item if you want each instance of this item occupies one slot.
- Max Amount: If the item is stackable, then this is the maximum amount allowed in one instance of that item type.
- Short Description: Short description that will be shown when the mouse hovers over the item in one of the UI panels.
- Currency: Leave this blank if you are creating a currency type item. This is the type of the currency that the player will buy or sell the item with.
- Currency Amount: Leave this blank if you are creating a currency type item. This is the amount of the currency type defined right above this field that the player will buy or sell the item with.
- Equipment Slot: Leave this blank if you are creating a currency type item or if you don’t want the item to be equipped.
- Attributes: When an item is equipped, it is able to change the player’s attributes by increasing or decreasing them. The attributes affected by this item when equipped are defined in the “Name” field, the amount to add or remove is set in the “Value” field.
- Skill Slot: Leave this blank if you are creating a currency type item or if you don’t want the item to be used in the skill bar.
- Usable: If the item can’t be equipped or used on the skill bar. You can make it usable directly from the inventory by ticking this option. You can choose to destroy or keep the item on use by ticking the “DestroyOnUse” field.
Make sure that the item’s icon and the item’s prefab are both in the “Resources” folder in the project in order to save/load them properly.