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.

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.

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

Was this helpful?