Scripts

v4.0

Scripts

A variety of scripts are included with the Drag-and-Drop Inventory System, which help drive the logic and runtime operations. Some need to be utilized on in-game objects, and others added to various prefabs for your items. See the setup sections for more details.

These are in the InfinityPBR.Modules.Inventory namespace.

Please see the sections OnScreenItem, PanelManager and Panel for information on those scripts, which are required in your scene.

The Prefab Inventory Module Required Scripts is required, and should be brought into your scene. It holds the PanelManager and OnScreenItem classes.

You will then need to populate the fields. Check the scripts detail pages for more.

This is the main management script for the Inventory system, and handles the active panels.

This is the class which manages the item that is "held" on the screen. When held, it follows the mouse, as if the player is holding the item.

This is the script which drives the in game UI panel of buttons on a grid, where UI inventory items will be shown. Please reference the prefabs to see how they are utilized in the demo scene.

GridButton

This script is attached to the UI button prefabs (Inventory Grid Button) and handles player interaction with the button.

GridRow

This script is used on the Panel, and holds a List<GameObject> of UI buttons (grid buttons). A List<GridRow> will hold all the buttons in the UI panel.

Item Scripts

Please see the Item Setup section for details on how to set up your item prefabs for the Drag-and-Drop Inventory System.

Each Item will have two objects, one for the inventory display, and one for the world display. They should be based on the same prefab/mesh, but will have slightly different setups.

ItemInventory

This is added to the Inventory version of your items. The GameObject field inGamePrefab should be populated with the world version of the item.

ItemWorld

This should be attached to the world version of your items. You do not need to populate the ItemObject data -- that will be populated automatically at run time.

Note, if you are instantiating items into the world outside of the Drag-and-Drop Inventory System, then you will need to populate the ItemObject data appropriately.

Box Manager

This script controls our virtual treasure boxes. Check the "Small Treasure Box" and "Lucky Large Treasure Box" objects in the world scene of the Party Based RPG demo game.

Last updated