private void Awake() { if (navMesh && navMesh.GetComponent <Collider>()) { // Turn off all NavMesh objects, then turn on the selected one NavigationMesh[] navMeshes = FindObjectsOfType(typeof(NavigationMesh)) as NavigationMesh[]; foreach (NavigationMesh _navMesh in navMeshes) { if (navMesh != _navMesh) { _navMesh.TurnOff(); } } navMesh.TurnOn(); } }