Inventory
Pull inventory branch which has inventory system implemented.
Open Jungle Scene in Inventory branch and preview picking up objects functionalities.
Open Scripable Objects/Inventory
directory and you will see inventory 1
and inventory 2
two inventories. Currently the demo use inventory 1 so you can watch how inventory 1 changes when player interacting with objects. To add new inventory, right click mouse and select Create
you will see inventory system -> inventory
which will create one scriptale inventory. You can reference this inventory in Player
and InventoryDisplay
script for item pickup and display.
The database contains information for all the items involved in the game. Item information is stored in an object of type ItemDatabase
, an example is Scripable Objects/Inventory/database 1
, you can add items to database so they can be used in-game for pick-up/ interaction. To create new database, right click mouse and select Create
you will see inventory system -> items -> database
which will create one database. Once created, you can reference the database in inventory so that everything added to the inventory will be referring to items in database.
To create new item prototype (scriptable object), right click mouse and select Create
you will see inventory system -> items -> Default
which will create one scriptale Item prototype. Item prototype can be attached to in-game GameObject so the object can be picked up and put into player inventory.
Player
script in Scripts/Character
is used for add player interaction with items. Add this script as a component to player in game enables player to pick up objects and interact with objects like door and lock.
In the demo, there is a Canvas object set up with a child Panel named InventoryDisplay, these two combines and became a basic inventory display. You can simply copy the canvas to other game scenes to display inventory. Dont forget to change the inventory property in the child panel Display Inventory component, this will attach to the inventory you want to display.