error CS1061: 'Inventory' does not contain a definition for 'slots' and no accessible extension method 'slots' accepting a first argument of type 'Inventory' could be found (are you missing a using directive or an assembly reference?)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pickup : MonoBehaviour
{
private Inventory inventory;
public GameObject slotButton;
private void Start()
{
Inventory = GameObject.FindGameObjectWithTag("Player").GetComponent<Inventory>();
}
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CampareTag("Player"))
{
for (int i = 0; i < inventory.slots.Length; i++)
{
if(inventory.isFull[i] == false)
{
inventory.isFull[i] = true;
Instantiate(slotButton, inventory.slots[i].transform);
Destroy(gameObject);
break;
}
}
}
}
}