I cant get this code to execute but it works fine without the key press any way to fix this
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public InventoryObject inventory;
public void OnTriggerStay(Collider other)
{
var item = other.GetComponent<Item>();
if(item && Input.GetKeyDown(KeyCode.E))
{
inventory.AddItem(item.item, 1);
Destroy(other.gameObject);
}
}
}