So I’m making an inventory system, and so far, it’s collision based. I want to press ‘E’ to pick up the object, but adding a line enforcing that seems to make it fail.
Yes, I know I should probably be using rays for this, but while it’s still rudimentary, I am using colliders until I know that everything else is working as intended.
this is the part of the script that is important, but if you need another part, just say so:
public void OnTriggerEnter(Collider other)
{
if (other.tag == “Item”)
{
pickup = other.gameObject;
AddItem(pickup);
}
I’ve tried to add a && Input.GetKeyDown(KeyCode.E) to the if statement, but for some reason this makes it fail.