Core Concepts

This section shows, how the ItemSystem is coded. You get information about code structure and class inheritance. This is the first place to look at when you are planning to extend the system.

ItemContainer extends from UIContainer and provides optional behaviour settings. This component implements a list of items and slots and should be used as a storage for items. With the dynamic container option ticked, the system will create unlimited slots. With this component you can create Inventory, Equipment, Store, Actionbar, Loot and Bank type containers.

UIStack extends from UIWidget and is a singleton class. This means that only one component of this type should exist in your scene. The ui element will be shown when the player tries to split a stack of items. See also UISlot/ItemSlot.

Tooltip is a common graphical user interface element, used in conjunction with the cursor. The user hovers the pointer over an ui element and a tooltip may appear with information about the element. Please see Tooltip.

The system uses slots to display item content. ItemSlot is the component that has reference to ui elements and implements built in unity handlers IDropHandler, IBeginDragHandler, IDragHandler and others. In combination with ItemContainer, this script handles the storage behaviour. ItemSlots can have multiple validation processes, in the picture below is an EquipmentRegion and a category validation setup. As default ItemSlots except any type of item.

The ItemContainerTrigger component can be used to open an ItemContainer.  It will add items defined in the list to the container window. Optionally you can clear the container before adding items, generate random item properties or animate the trigger game object.

The components can be attached to a game object through the unity toolbar.

By default there are three item types availible. If you wish to create a custom item type you should extend from one of the item types above. This will make your item type work with the built in database and editor. All items are stored in a database. Loading an item from the database and changing it’s properties will change them permanently. Use Instantiate to clone an item, that you can modify at runtime.

Each UsableItem has an action list, that will be executed when the item is used. You can setup the action list in the ItemEditor. To create a custom action, extend from BehaviourAction and override the Execute(Item item) method. BehaviourActions are assets and not binded to the scene!