Scene & Class Setup
v4.0
Last updated
Was this helpful?
v4.0
Last updated
Was this helpful?
To make use of the Drag-and-Drop Inventory System, some setup is required. Refer to the Party Based RPG demo game for reference.
The module uses a layer for displaying UI inventory. Create one called UIInventory.
The prefab Canvas 1920x1080
is a UI Canvas which you may find helpful to start with. This is the canvas used in the demo scene.
The "Demo Objects" and "Player Portraits" (highlighted in red below) are likely able to be removed for your project. Be sure to use the demo scene first to better understand what these sections do, as you may be able to make use of them for your project.
The objects turned off, Inventory Panel, Box Inventory Panel, and Small Box Inventory Panel, are useful if you'd like to create your own inventory panel prefabs using these as starting points. They are used in the demo scene, but can be utilized in your own projects, modified or unmodified. Be sure to create your own original prefabs from these objects.
This light is used to illuminate the UI inventory objects. While this is not required, we suggest you set up your inventory system before modifying the lighting.
This is the parent transform for the item being held by the OnScreenItem
script. This is required, though you could technically replace it with another parent if you have a reason to.
Bring the prefab Inventory Module Required Scripts
into your scene. Alternatively, you can add the scripts OnScreenItem
and PanelManager
into your scene. These scripts are required for the Inventory system to work.
Remember to populate the "Required" references in the inspector.
Remember to populate the "Required" references in the inspector.
IHaveInventory
Any class that has an inventory should implement IHaveInventory
.
If your custom Actor
class inherits from GameModulesInventoryActor
, then you already have most of what you need set up for your player inventory!
This script handles inventory objects when they are "held" by the player but not in a specific inventory. See the for more details.
This script manages the various UI panels for visual inventories. Note that the playerInventoryPanel
is meant to always be in the scene, while panels that populate otherPanel
will be instantiated and destroyed at runtime -- these are panels which represent the inventories of other objects like treasure boxes, or enemies. See the section for more details.