public void ExecuteTaskAndUpdateWorldState() { // grab crate near you Collider[] colliders = Physics.OverlapSphere((Vector3)WorldState.get(7), 4f); // we pick the first crate that comes in our overlapsphere foreach (Collider c in colliders) { if (c.transform.name.Contains("Crate")) { // will this work? yes :) Crate crate = c.gameObject.GetComponent <Crate>(); // throw at current destination of player crate.ThrowCrate((Vector3)WorldState.get(8)); return; // otherwise we throw all the nearby crates } } }