Inventory system error please help me

hey guys
This is the scripts

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Inventory : MonoBehaviour {
    public List<Item> inventory = new List<Item>();
    private ItemDatabase database;
   
   
    // Use this for initialization   
    void Start () {
        database = GameObject.FindGameObjectWithTag("Item Database").GetComponent<Database>();
        inventory.Add(database.items[0]);
        inventory.Add(database.items[1]);
    }
   
    void OnGUI()
    {
        for(int i = 0; i <inventory.Count; i++)
        {
            GUI.Label(new Rect(10,i * 20,200,50), inventory[i].itemName);
        }
    }
}

and play game
unity give me this error: Item Database is not defined why? wat is the problem ?
I use this tutorials

You declare an ItemDatabase type, but you are getting the component of Database type…

Given that it’s complaining about the item database I suspect that is meant to be database. Check what the type is actually called in the script which defines it, case sensitive of course.

1 Like