private void OntriggerEnter(Collider other) { ItemWorld itemWorld = other.GetComponent<ItemWorld>(); if(itemWorld != null) { // add to the player's inventory inventory.AddItem(itemWorld.GetItem()); // destroy from world itemWorld.DestroySelf(); } }
OntriggerEnter should be OnTriggerEnter