I’ve just finished the adventure game tutorial and it works fine but i can’t use items and i don’t know why. i literally copied and pasted the inventory script on the inventory tutorial and it still doesn’t work. if left clicking on the robot while holding the coin isn’t working, where else could the glitch be?
I’m running 2017.3
here’s the code I’m using
using UnityEngine;
using UnityEngine.UI;
public class Inventory : MonoBehaviour
{
public Image[] itemImages = new Image[numItemSlots];
public Item[] items = new Item[numItemSlots];
public const int numItemSlots = 4;
public void AddItem(Item itemToAdd)
{
for (int i = 0; i < items.Length; i++)
{
if (items *== null)*
-
{*
_ items = itemToAdd;_
_ itemImages*.sprite = itemToAdd.sprite;
itemImages.enabled = true;
return;
}
}
}
public void RemoveItem (Item itemToRemove)
{
for (int i = 0; i < items.Length; i++)
{
if (items == itemToRemove)
{
items = null;
itemImages.sprite = null;
itemImages.enabled = false;
return;
}
}
}
}*_