Adventure Game tutorial (can't buy coffee)

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;
}
}
}
}*_

Good day.

I did not read the code, not did the tutorial, don’t know exactly what it does or how, but what i can say is:

Understanding the tutorial is correct and it really works, if you have exactly the same scripts, named the same, the only problem you can have is inside Unity.

Maybe you did not attach some script to some object, maybe you forget some other component to some object, maybe some component is not configuret correctly, or maybe some script name is not correct.

You should check all of this. But the best way is to track the code by debugging, and you need to learn to find where the code commence to do something you dont want, to detect where is the problem. some null reference, some bad reference, etc…

Good Luck! Bye!