public void Update() { var distance = inventory.transform.position - container.transform.position; if (!inventory.HasContainer(container.gameObject)) { Destroy(this); } else if (distance.sqrMagnitude > (range * range)) { inventory.RemoveContainer(container.gameObject); Destroy(this); } }