private void GetRackInfo() { racks = GameObject.FindGameObjectsWithTag(Tags.rack).OrderBy(go => go.name).ToArray(); rackWPs = new Vector3[racks.Length]; rackScripts = new WeaponRack[racks.Length]; spawnBoxes = new BoxCollider[racks.Length][]; for (int i = 0; i < racks.Length; i++) { rackScripts[i] = racks[i].GetComponent <WeaponRack>(); Vector3 rack = racks[i].transform.position; UnityEngine.AI.NavMeshHit hit; if (UnityEngine.AI.NavMesh.SamplePosition(rack, out hit, 0.5f, UnityEngine.AI.NavMesh.AllAreas)) { rack = hit.position; } rackWPs[i] = rack; spawnBoxes[i] = rackScripts[i].spawnZone.ToArray(); TargetControl.Shuffle <BoxCollider> (spawnBoxes[i]); } }