void CheckForPickup() { if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Space)) { if (crate != null) { if (isCarrying) { // we're already carrying the crate, so drop it crate.transform.parent = null; isCarrying = false; bool onChute = spawnManager.chuteBounds.Contains(crate.transform.position); if (onChute) { spawnManager.CrateDelivered(crate); crate = null; } } else { // otherwise pick up the crate crate.PickedUp(); crate.transform.parent = this.transform; isCarrying = true; } } else { // no crate no_crate.Play(); } } }