Adding an inventory item agent

We need the means to interact with our inventory items. In order to do this, we will need to create a new script that will handle our interaction with the inventory items during game play. This will be coded in the InventoryItemAgent.cs script. At the moment, the script will just enable us to interact with the InventoryItem object through the IDE.

A listing of the script is as follows:

using UnityEngine;namespace com.noorcon.rpg2e{public class InventoryItemAgent : MonoBehaviour{public InventoryItem Item;}}

Very simply, in order for us to be able to interact with the GameObject, we would need to use a script that inherits MonoBehaviour. Go ahead and attach this script to your prefab. Now you can easily set up ...

Get Building an RPG with Unity 2018 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.