Install and Configure

Installation, Configuration details for the Inventory System.

Video that shows Installation and Configuration of the Inventory System Described Below

Installation Details

Version1: Disabled Link: Download Link: Inventory System Code Unity Package

UPDATED - Version 2: Download Link: Inventory System Code - Version 2 - Unity Package 4/11/2020

IMPORTANT; If you imported InventorySystem prior to using the updated version 2, 4/11/2020, then import the updated code files using the package below.

- Updated Inventory System Code Files - To overwrite Version 1 - files: 4/13/2020

Step 1. IMPORTANT: Prior to Importing the Package: DELETE the following Scripts in your project: PickUp.cs, GameData.cs You will import new versions of these files, so you need to delete the old versions to insure you don't end up with 2 instances of a script. If the package scripts are in a different folder structure than they are in your project, then they won't get overwritten and you'll have 2 versions of the scripts, it may be difficult to tell which one needs to be deleted, so do that as the first step.

Step 2. Import Custom Package: In your Unity project, select top menu: Assets > Import Package > Custom Package: Select from downloads: InventorySystem_S20_v1

You should see the items listed in the image below. Submit using the Import Button

Configuration Details - Fix any Code Errors

IMPORTANT FIX POSSIBLE CODE ERRORS: See Details for Fix for Possible Errors in PlayerStats.cs due to inconsistent variable name: score / Score vs totalScore / TotalScore in GameData.cs

//FIX CODE IN PlayerStats.cs
private void UpdateDisplay()
    {
        scoreText.text = "Score: " + GameData.instanceRef.Score; //replace .TotalScore
        healthText.text = "Health: " + GameData.instanceRef.Health;
    }

Step 1: BeginScene - GameData issues:

  • In BeginScene, make sure the GameManager gameObject has no errors on the GameData.cs script component. (TO FIX: Remove component, re-add)

  • Create an Inventory ScriptableObject: named: Inventory. ( no additional configuration needed for GameInventory scriptableObject )

  • Add GameInventory scriptableObject to the GameData.cs component on GameManager.

Step 2 - Add Prefabs to Canvas in Scene

In the Prefabs Folder, find the ISimple_Inventory and the BtnAddDiamond prefabs Drag both prefabs onto the Canvas. Position the objects by setting the Rect-Transform Anchors so they are constrained and visible in the SceneView as shown in the image below

Edit ISimple_Inventory Prefab: Attach InventoryDisplay.cs Script

Edit the InventoryDisplay Prefab by Attaching InventoryDisplay.cs to the Top-Level Panel of ISimple_Inventory Prefab. Save Project and Scene. Note in the image below: the InventoryDisplay.cs component has been added. Also note the use of a Grid Layout Group Component.

Play the Scene to Verify Installation / Configuration

When playing the scene, you should be able to click the btnAddDiamond button and see items added to 1-cell of the ISimple_Inventory prefab. Clicking the item within the inventory should remove an item from the grid. If you play the scene with GameData selected in the Hierarchy, you should be able to see the inventory scriptableObject dynamically changing to show items added and removed from the inventory display.

Last updated