# Install and Configure

{% embed url="<https://youtu.be/OmJbQ3X6slE>" %}

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

### Installation Details

&#x20; Version1: **Disabled Link:&#x20;*****Download Link: Inventory System Code Unity Package***&#x20;

**UPDATED - Version 2:** [ **Download Link:  Inventory System Code - Version 2 - Unity Package**](https://utdallas.box.com/s/p7ypi8yk3l4e6hb6ejwxzxwpn89e48d7) **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.&#x20;

&#x20;    \-  [**Updated Inventory System Code Files - To overwrite Version 1 - files:**](https://utdallas.box.com/s/v4o36lcfsmoyz4ig9tuuvdyidezacxar)  **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

![Import Custom Package](/files/-M4AK1OsLFEoU0Yx7xzI)

### Configuration Details - Fix any Code Errors

**IMPORTANT FIX POSSIBLE CODE ERRORS:**  See [Details for Fix](/cs2335/f20_bkup_v2/inventory-system/inventory-scriptableobject/updated-inventorysystem/pickup-gamedata-mods.md) for Possible Errors in **`PlayerStats.cs`** due to inconsistent variable name:  score / Score vs totalScore / TotalScore in **`GameData.cs`**

```csharp
//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:** &#x20;

* 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.

![](/files/-M4ALPvfEyUB2NNEVx0D)

![](/files/-M4ALsao9eInRljjaSua)

### 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

![](/files/-M4ANVxAFkeEdFkAGxQk)

### 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.

![](/files/-M4AOeoVlmpeS4pVM98m)

### Play the Scene to Verify Installation / Configuration&#x20;

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kdoore.gitbook.io/cs2335/f20_bkup_v2/inventory-system/inventory-scriptableobject/install-and-configure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
