Overview | Videos | Documentation | Demos | Integrations | API | Support

Doc Home > Inventory

The Inventory component manages all of the Items. It allows Items to be used, reloaded, dropped, etc. It also communicates with the Animator to trigger animations when switching between items. The Inventory uses an ItemType to map an Inventory Item to a particular Item that is held by the character. When the Inventory is initialized it will search through the components on the character for any component that has a type of Item. When it finds an Item it will add that Itemís ItemType to the inventory. The character doesnít actually have the Item yet - the Item still needs to be picked up by the character. It is only then that the Item can actually be used. The Inventory has a DefaultLoadout which will load the specified Items when the Inventory is first initialized.

The number of Items in the Inventory can be obtained from the GetItemCount method. This method takes two parameters - the first being the ItemType and the second being if the calling function is interested in the loaded or unloaded count. PrimaryItems have two different counts: one for the number of ConsumableItems that are loaded and one for the number of ConsumableItems that are not loaded yet. As an example, the ShootableWeapon uses these two different values for the number of bullets that have been loaded in the weapon and the number of ConsumableItems that have yet to be loaded. When the ShootableWeapon is reloaded it will take the unloaded ConsumableItems and add it to the loaded ConsumableItems.

The GUI interfaces with the Inventory to show the status such as number of bullets remaining or the number of SecondaryItems left. It does this using the SharedProperty class.

<- Item Extensions
Item Type ->