public void dropobject() { // remove agent from pickup if (pickuptarget) { PickupController targetController = pickuptarget.GetComponentInChildren <PickupController>(); if (targetController) { targetController.removeAgentFromCarryPoint(this.gameObject, pickupCarryIndexAndPositionOffset.Key); } else { Debug.Log("Couldn't find pickup controller"); } // reset pickup's rigidbody constraints if (pickuptarget.GetComponent <Rigidbody>()) { pickuptarget.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; } if (pickuptarget.transform.parent.GetComponent <Rigidbody>()) { pickuptarget.transform.parent.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; } } resetNav(); pickuptarget = null; agentcontroller.agentState = AgentState.Idle; agentcontroller.dismiss(); // todo: if player nearby, follow instead of idling }