Next: Pickable, Previous: Clip Inventory, Up: Inventory [Contents][Index]
Does not use object pooling. This component implements a locally-saved single-player only inventory for player items. It’s static, meaning there can only be one at any given time, or weird stuff might happen (probably not, but no guarantees). Each inventory item needs 2 prefabs: an ’ActiveItem’ which represents the object while it’s in-use, as well as a ’Pickable’ which represents the item when it’s on the ground. These need to have references to each other in the inspector and they all need to be in a’Resources’ folder or you might get errors when saving & loading.
int
inventorySizeMax items in inventory
Default value: 10
bool
controlCursorStateShould we lock the cursor when closing the inventory, and unlock it when opening the inventory?
Default value: false
KeyCode
inventoryKeyKey allowing the player to open/close the inventory GUI
Default value: KeyCode.I
bool
allowNumberKeysCan the first items be accessed using number keys? This iterates through the inventory in-order looking for anything that is set to ’Weapon R’ mount (right-handed weapon).
Default value: true
float
weaponSwapSensitivityHow sensitive is the mouse wheel when switching weapons?
Default value: 0.025f
bool
showInventoryGUIShould we show the GUI displaying the inventory contents?
Default value: false
bool
useHandButtonsShould we use buttons to drop/stow items held in the hand?
Default value: true
Rect
inventoryAreaNormalized viewport rectangle indicating the inventory GUI area
Default value: new Rect(.2f,.2f,.6f,.6f)
int
numButtonsPerRowHow many buttons can we have in a row?
Default value: 4
int
numButtonsPerColumnHow many buttons can we have in a column?
Default value: 4
Saves the inventory in a binary file on the player’s machine. Does not work on web builds
Loads inventory from a binary file on the player’s machine. Does not work on web builds
Allows you to remove an item from the player’s inventory by passing it’s inventory key
Argument: The inventory key of the item you want to remove
Searches the inventory for the next Active Object with ’Item Type’ of ’WeaponR’ and equips it
Argument: Should we reverse the operation (previous weapon)?
int
inventorySizeMax items in inventory
Default value: 10
bool
controlCursorStateShould we lock the cursor when closing the inventory, and unlock it when opening the inventory?
Default value: false
KeyCode
inventoryKeyKey allowing the player to open/close the inventory GUI
Default value: KeyCode.I
bool
allowNumberKeysCan the first items be accessed using number keys? This iterates through the inventory in-order looking for anything that is set to ’Weapon R’ mount (right-handed weapon).
Default value: true
float
weaponSwapSensitivityHow sensitive is the mouse wheel when switching weapons?
Default value: 0.025f
bool
showInventoryGUIShould we show the GUI displaying the inventory contents?
Default value: false
bool
useHandButtonsShould we use buttons to drop/stow items held in the hand?
Default value: true
Rect
inventoryAreaNormalized viewport rectangle indicating the inventory GUI area
Default value: new Rect(.2f,.2f,.6f,.6f)
int
numButtonsPerRowHow many buttons can we have in a row?
Default value: 4
int
numButtonsPerColumnHow many buttons can we have in a column?
Default value: 4
Saves the inventory in a binary file on the player’s machine. Does not work on web builds
Loads inventory from a binary file on the player’s machine. Does not work on web builds
Allows you to remove an item from the player’s inventory by passing it’s inventory key
Argument: The inventory key of the item you want to remove
Searches the inventory for the next Active Object with ’Item Type’ of ’WeaponR’ and equips it
Argument: Should we reverse the operation (previous weapon)?
Next: Pickable, Previous: Clip Inventory, Up: Inventory [Contents][Index]