1. Home
  2. S-Inventory
  3. Equipment
  4. Equipment Slots

Equipment Slots

The Equipment component allows you to equip items from the inventory.

 

  • Attributes: The player’s attributes that are subject to change when the player equips an item. For each attribute assign a name and a default value. Attributes can allow you to customize you S-Inventory even more by using the static function “Equipment.GetAttributeValue(NAME)” to get the value of attributes in your code.
  • Equipment Slots: This array holds all the equipment slots information. Change the size of this array to the number of the equipment slots you want to have. Assign a name for each equipment slot. To create items for these equipment slots, make sure you input the exact name of the equipment slot in the “Item.cs” script. For each slot, create an empty UI object and add an Image component with the empty slot sprite. Then, create another Image UI element and make it a child object of the previous one and call it “Icon” and drag it to its field in the Equipment Slots array. In the “Icon” object, add the “SlotUI.cs” script and set only “Equipment Item” to true then add an Event Trigger with the following event:
  1. Pointer Click event: Drag and drop the “Icon” object and select: “SlotUI -> SendEquipmentClick()”.
  2. Begin Drag event: Drag and drop the “Icon”object and select: “SlotUI -> DragItem()”.
  3. End Drag event: Drag and drop the “Icon” object and select: “SlotUI -> DisableItemDrag()”.
  4. Pointer Enter event: Drag and drop the “Icon” object and select: “SlotUI -> HoverON()” and “SlotUI -> SetDragDestination()”.
  5. Pointer Exit event: Drag and drop the “Icon” object and select: “SlotUI -> HoverOFF()” and “SlotUI -> RemoveDragDestination()”.
  • Key: The keyboard key that toggles the equipment UI menu.
  • Equipment Objects: When equipping items, S-Inventory allows to activate objects to display that an item has been equipped. Just enter the name of the item that allows to activate an object then drag and drop the desired object from the scene to the “Obj” field.
  • Default Item: This is a prefab that exists in your project files and which has the “Item.cs” component. This prefab has default settings and will be used in loading saved items. There’s one ready default item in the project: S-Inventory -> Default Item.
  • Save And Load: Check this option if you want to save and load equipped items.
Was this article helpful to you? Yes No

How can we help?