I’ve been trying to add a pickup script for a game me and a couple others are working on, for some reason “inventory” isn’t recognised or something and gives me an error, any help would be appreciated, thank you. (PS: I’m very new to C# and scripting in general)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
private Inventory inventory;
public class PickUp : MonoBehaviour {
private void Start ()
{
inventory = GameObject.FindGameObjectWithTag("Player").GetComponent<Inventory>();
}
// Update is called once per frame
void OnTriggerEnter (Collider other)
{
if (other.CompareTag("Player")) {
for (int i = 0; i < inventory.slots.Length; i++)
{
if (inventory.isFull[i] == false)
}
}
}
}