private void ResetHoles(NavigationMesh navMesh, bool rebuild) { if (navMesh == null || navMesh.GetComponent <PolygonCollider2D>() == null) { return; } CalcSearchRadius(navMesh); PolygonCollider2D poly = navMesh.GetComponent <PolygonCollider2D>(); poly.pathCount = 1; if (navMesh.polygonColliderHoles.Count == 0) { if (rebuild) { RebuildVertexArray(navMesh.transform, poly); CreateCache(); } return; } Vector2 scaleFac = new Vector2(1f / navMesh.transform.localScale.x, 1f / navMesh.transform.localScale.y); foreach (PolygonCollider2D hole in navMesh.polygonColliderHoles) { if (hole != null) { poly.pathCount++; List <Vector2> newPoints = new List <Vector2>(); foreach (Vector2 holePoint in hole.points) { Vector2 relativePosition = hole.transform.TransformPoint(holePoint) - navMesh.transform.position; newPoints.Add(new Vector2(relativePosition.x * scaleFac.x, relativePosition.y * scaleFac.y)); } poly.SetPath(poly.pathCount - 1, newPoints.ToArray()); hole.gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer); hole.isTrigger = true; } } if (rebuild) { RebuildVertexArray(navMesh.transform, poly); CreateCache(); } }
private void Awake() { // Turn off all NavMesh objects NavigationMesh[] navMeshes = FindObjectsOfType(typeof(NavigationMesh)) as NavigationMesh[]; foreach (NavigationMesh _navMesh in navMeshes) { if (navMesh != _navMesh) { _navMesh.TurnOff(); } } // Turn on default NavMesh if using MeshCollider method if (navMesh && (navMesh.GetComponent <Collider>() || navMesh.GetComponent <Collider2D>())) { navMesh.TurnOn(); } }
public override void TurnOn(NavigationMesh navMesh) { if (navMesh == null || KickStarter.settingsManager == null) { return; } if (LayerMask.NameToLayer(KickStarter.settingsManager.navMeshLayer) == -1) { ACDebug.LogError("Can't find layer " + KickStarter.settingsManager.navMeshLayer + " - please define it in Unity's Tags Manager (Edit -> Project settings -> Tags and Layers)."); } else if (!string.IsNullOrEmpty(KickStarter.settingsManager.navMeshLayer)) { navMesh.gameObject.layer = LayerMask.NameToLayer(KickStarter.settingsManager.navMeshLayer); } if (navMesh.GetComponent <Collider2D>() == null) { ACDebug.LogWarning("A 2D Collider component must be attached to " + navMesh.gameObject.name + " for pathfinding to work - please attach one."); } }
public override void ResetHoles(NavigationMesh navMesh) { if (navMesh == null || navMesh.GetComponent <MeshCollider>() == null || navMesh.GetComponent <MeshCollider>().sharedMesh == null) { return; } if (navMesh.GetComponent <MeshCollider>().sharedMesh == null) { if (navMesh.GetComponent <MeshFilter>() && navMesh.GetComponent <MeshFilter>().sharedMesh) { navMesh.GetComponent <MeshCollider>().sharedMesh = navMesh.GetComponent <MeshFilter>().sharedMesh; ACDebug.LogWarning(navMesh.gameObject.name + " has no MeshCollider mesh - temporarily using MeshFilter mesh instead."); } else { ACDebug.LogWarning(navMesh.gameObject.name + " has no MeshCollider mesh."); } } }
public override void OnReset(NavigationMesh navMesh) { if (!Application.isPlaying) { return; } is2D = true; ResetHoles(navMesh); if (navMesh && navMesh.characterEvasion != CharacterEvasion.None && navMesh.GetComponent <PolygonCollider2D>()) { PolygonCollider2D[] polys = navMesh.PolygonCollider2Ds; if (polys != null && polys.Length > 1) { ACDebug.LogWarning("Character evasion cannot occur for multiple PolygonColliders - only the first on the active NavMesh will be affected."); } for (int i = 0; i < polys.Length; i++) { if (!polys[i].isTrigger) { ACDebug.LogWarning("The PolygonCollider2D on " + navMesh.gameObject.name + " is not a Trigger.", navMesh.gameObject); } if (polys[i].offset != Vector2.zero) { ACDebug.LogWarning("The PolygonCollider2D on " + navMesh.gameObject.name + " has a non-zero Offset - this can cause pathfinding errors. Clear this offset and adjust the GameObject's position if necessary.", navMesh.gameObject); } } } if (navMesh == null && KickStarter.settingsManager && KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick) { ACDebug.LogWarning("Could not initialise NavMesh - was one set as the Default in the Scene Manager?"); } }
public override NavigationMesh NavigationMeshGUI(NavigationMesh _target) { _target = base.NavigationMeshGUI(_target); _target.characterEvasion = (CharacterEvasion)CustomGUILayout.EnumPopup("Character evasion:", _target.characterEvasion, "", "The condition for which dynamic 2D pathfinding can occur by generating holes around characters"); if (_target.characterEvasion != CharacterEvasion.None) { _target.characterEvasionPoints = (CharacterEvasionPoints)CustomGUILayout.EnumPopup("Evasion accuracy:", _target.characterEvasionPoints, "", "The number of vertices created around characters to evade"); _target.characterEvasionYScale = CustomGUILayout.Slider("Evasion y-scale:", _target.characterEvasionYScale, 0.1f, 1f, "", "The scale of generated character evasion 'holes' in the NavMesh in the y-axis, relative to the x-axis"); EditorGUILayout.HelpBox("Note: Characters can only be avoided if they have a Circle Collider 2D (no Trigger) component on their base.\n\n" + "For best results, set a non-zero 'Pathfinding update time' in the Settings Manager.", MessageType.Info); if (_target.transform.lossyScale != Vector3.one) { EditorGUILayout.HelpBox("For character evasion to work, the NavMesh must have a unit scale (1,1,1).", MessageType.Warning); } #if UNITY_ANDROID || UNITY_IOS EditorGUILayout.HelpBox("This is an expensive calculation - consider setting this to 'None' for mobile platforms.", MessageType.Warning); #endif } _target.accuracy = CustomGUILayout.Slider("Accuracy:", _target.accuracy, 0f, 1f, "", "A float that can be used as an accuracy parameter, should the algorithm require one"); _target.gizmoColour = CustomGUILayout.ColorField("Gizmo colour:", _target.gizmoColour, "", "The colour of its Gizmo when used for 2D polygons"); EditorGUILayout.Separator(); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); EditorGUILayout.LabelField("NavMesh holes", EditorStyles.boldLabel); for (int i = 0; i < _target.polygonColliderHoles.Count; i++) { EditorGUILayout.BeginHorizontal(); _target.polygonColliderHoles [i] = (PolygonCollider2D)CustomGUILayout.ObjectField <PolygonCollider2D> ("Hole #" + i.ToString() + ":", _target.polygonColliderHoles [i], true, "", "A shape within the boundary of this PolygonCollider2D to create a hole from"); if (GUILayout.Button("-", GUILayout.MaxWidth(20f))) { _target.polygonColliderHoles.RemoveAt(i); i = -1; continue; } EditorGUILayout.EndHorizontal(); if (_target.polygonColliderHoles[i] != null && _target.polygonColliderHoles[i].GetComponent <NavMeshBase>()) { EditorGUILayout.HelpBox("A NavMesh cannot use its own Polygon Collider component as a hole!", MessageType.Warning); } } if (GUILayout.Button("Create new hole")) { _target.polygonColliderHoles.Add(null); } if (_target.GetComponent <PolygonCollider2D>() != null) { int numPolys = _target.GetComponents <PolygonCollider2D>().Length; if (numPolys > 1) { if (_target.polygonColliderHoles.Count > 0) { EditorGUILayout.HelpBox("Holes will only work if they are within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning); } if (_target.characterEvasion != CharacterEvasion.None) { EditorGUILayout.HelpBox("Character-evasion will only work within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning); } } } return(_target); }
public override NavigationMesh NavigationMeshGUI(NavigationMesh _target) { _target = base.NavigationMeshGUI(_target); _target.characterEvasion = (CharacterEvasion)EditorGUILayout.EnumPopup("Character evasion:", _target.characterEvasion); if (_target.characterEvasion != CharacterEvasion.None) { _target.characterEvasionPoints = (CharacterEvasionPoints)EditorGUILayout.EnumPopup("Evasion accuracy:", _target.characterEvasionPoints); _target.characterEvasionYScale = EditorGUILayout.Slider("Evasion y-scale:", _target.characterEvasionYScale, 0.1f, 1f); EditorGUILayout.HelpBox("Note: Characters can only be avoided if they have a Circle Collider 2D (no Trigger) component on their base.\n\n" + "For best results, set a non-zero 'Pathfinding update time' in the Settings Manager.", MessageType.Info); if (_target.transform.lossyScale != Vector3.one) { EditorGUILayout.HelpBox("For character evasion to work, the NavMesh must have a unit scale (1,1,1).", MessageType.Warning); } #if UNITY_ANDROID || UNITY_IOS EditorGUILayout.HelpBox("This is an expensive calculation - consider setting this to 'None' for mobile platforms.", MessageType.Warning); #endif } _target.accuracy = EditorGUILayout.Slider("Accuracy:", _target.accuracy, 0f, 1f); _target.gizmoColour = EditorGUILayout.ColorField("Gizmo colour:", _target.gizmoColour); EditorGUILayout.Separator(); GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); EditorGUILayout.LabelField("NavMesh holes", EditorStyles.boldLabel); for (int i = 0; i < _target.polygonColliderHoles.Count; i++) { EditorGUILayout.BeginHorizontal(); _target.polygonColliderHoles [i] = (PolygonCollider2D)EditorGUILayout.ObjectField("Hole #" + i.ToString() + ":", _target.polygonColliderHoles [i], typeof(PolygonCollider2D), true); if (GUILayout.Button("-", GUILayout.MaxWidth(20f))) { _target.polygonColliderHoles.RemoveAt(i); i = -1; } EditorGUILayout.EndHorizontal(); if (_target.polygonColliderHoles[i] != null && _target.polygonColliderHoles[i].GetComponent <NavMeshBase>()) { EditorGUILayout.HelpBox("A NavMesh cannot use its own Polygon Collider component as a hole!", MessageType.Warning); } } if (GUILayout.Button("Create new hole")) { _target.polygonColliderHoles.Add(null); } if (_target.GetComponent <PolygonCollider2D>() != null) { int numPolys = _target.GetComponents <PolygonCollider2D>().Length; if (numPolys > 1) { if (_target.polygonColliderHoles.Count > 0) { EditorGUILayout.HelpBox("Holes will only work if they are within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning); } if (_target.characterEvasion != CharacterEvasion.None) { EditorGUILayout.HelpBox("Character-evasion will only work within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning); } } } return(_target); }
public override void OnReset(NavigationMesh navMesh) { if (!Application.isPlaying) { return; } is2D = true; ResetHoles(navMesh); if (navMesh != null && navMesh.characterEvasion != CharacterEvasion.None && navMesh.GetComponent <PolygonCollider2D>() != null) { PolygonCollider2D[] polys = navMesh.GetComponents <PolygonCollider2D>(); if (polys != null && polys.Length > 1) { ACDebug.LogWarning("Character evasion cannot occur for multiple PolygonColliders - only the first on the active NavMesh will be affected."); } for (int i = 0; i < polys.Length; i++) { if (!polys[i].isTrigger) { ACDebug.LogWarning("The PolygonCollider2D on " + navMesh.gameObject.name + " is not a Trigger."); } } } if (navMesh == null && KickStarter.settingsManager != null && KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick) { ACDebug.LogWarning("Could not initialise NavMesh - was one set as the Default in the Settings Manager?"); } }
public override NavigationMesh NavigationMeshGUI(NavigationMesh _target) { _target = base.NavigationMeshGUI(_target); _target.characterEvasion = (CharacterEvasion)EditorGUILayout.EnumPopup("Character evasion:", _target.characterEvasion); if (_target.characterEvasion != CharacterEvasion.None) { _target.characterEvasionPoints = (CharacterEvasionPoints)EditorGUILayout.EnumPopup("Evasion accuracy:", _target.characterEvasionPoints); _target.characterEvasionYScale = EditorGUILayout.Slider("Evasion y-scale:", _target.characterEvasionYScale, 0.1f, 1f); EditorGUILayout.HelpBox("Note: Characters can only be avoided if they have a Circle Collider 2D (no Trigger) component on their base.\n\n" + "For best results, set a non-zero 'Pathfinding update time' in the Settings Manager.", MessageType.Info); if (_target.transform.lossyScale != Vector3.one) { EditorGUILayout.HelpBox("For character evasion to work, the NavMesh must have a unit scale (1,1,1).", MessageType.Warning); } #if UNITY_ANDROID || UNITY_IOS EditorGUILayout.HelpBox("This is an expensive calculation - consider setting this to 'None' for mobile platforms.", MessageType.Warning); #endif } _target.accuracy = EditorGUILayout.Slider("Accuracy:", _target.accuracy, 0f, 1f); int numOptions = _target.polygonColliderHoles.Count; numOptions = EditorGUILayout.IntField("Number of holes:", _target.polygonColliderHoles.Count); if (numOptions < 0) { numOptions = 0; } if (numOptions < _target.polygonColliderHoles.Count) { _target.polygonColliderHoles.RemoveRange(numOptions, _target.polygonColliderHoles.Count - numOptions); } else if (numOptions > _target.polygonColliderHoles.Count) { if (numOptions > _target.polygonColliderHoles.Capacity) { _target.polygonColliderHoles.Capacity = numOptions; } for (int i = _target.polygonColliderHoles.Count; i < numOptions; i++) { _target.polygonColliderHoles.Add(null); } } for (int i = 0; i < _target.polygonColliderHoles.Count; i++) { _target.polygonColliderHoles [i] = (PolygonCollider2D)EditorGUILayout.ObjectField("Hole #" + i.ToString() + ":", _target.polygonColliderHoles [i], typeof(PolygonCollider2D), true); } if (_target.GetComponent <PolygonCollider2D>() != null) { int numPolys = _target.GetComponents <PolygonCollider2D>().Length; if (numPolys > 1) { if (numOptions > 0) { EditorGUILayout.HelpBox("Holes will only work if they are within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning); } if (_target.characterEvasion != CharacterEvasion.None) { EditorGUILayout.HelpBox("Character-evasion will only work within the boundaries of " + _target.gameObject.name + "'s FIRST PolygonCollider component.", MessageType.Warning); } } } return(_target); }
public override void OnReset(NavigationMesh navMesh) { is2D = true; ResetHoles(navMesh); if (navMesh != null && navMesh.characterEvasion != CharacterEvasion.None && navMesh.GetComponent <PolygonCollider2D>() != null) { PolygonCollider2D[] polys = navMesh.GetComponents <PolygonCollider2D>(); if (polys != null && polys.Length > 1) { ACDebug.LogWarning("Character evasion cannot occur for multiple PolygonColliders - only the first on the active NavMesh will be affected."); } for (int i = 0; i < polys.Length; i++) { if (!polys[i].isTrigger) { ACDebug.LogWarning("The PolygonCollider2D on " + navMesh.gameObject.name + " is not a Trigger."); } } } }
private void ResetHoles(NavigationMesh navMesh, bool rebuild) { if (navMesh == null || navMesh.GetComponent <PolygonCollider2D>() == null) return; PolygonCollider2D poly = navMesh.GetComponent <PolygonCollider2D>(); poly.pathCount = 1; if (navMesh.polygonColliderHoles.Count == 0) { if (rebuild) { RebuildVertexArray (navMesh.transform, poly); } return; } Vector2 scaleFac = new Vector2 (1f / navMesh.transform.localScale.x, 1f / navMesh.transform.localScale.y); foreach (PolygonCollider2D hole in navMesh.polygonColliderHoles) { if (hole != null) { poly.pathCount ++; List<Vector2> newPoints = new List<Vector2>(); foreach (Vector2 holePoint in hole.points) { Vector2 relativePosition = hole.transform.TransformPoint (holePoint) - navMesh.transform.position; newPoints.Add (new Vector2 (relativePosition.x * scaleFac.x, relativePosition.y * scaleFac.y)); } poly.SetPath (poly.pathCount-1, newPoints.ToArray ()); hole.gameObject.layer = LayerMask.NameToLayer (KickStarter.settingsManager.deactivatedLayer); hole.isTrigger = true; } } if (rebuild) { RebuildVertexArray (navMesh.transform, poly); } }
public override void TurnOn(NavigationMesh navMesh) { if (navMesh == null) return; if (LayerMask.NameToLayer (KickStarter.settingsManager.navMeshLayer) == -1) { ACDebug.LogError ("Can't find layer " + KickStarter.settingsManager.navMeshLayer + " - please define it in Unity's Tags Manager (Edit -> Project settings -> Tags and Layers)."); } else if (KickStarter.settingsManager.navMeshLayer != "") { navMesh.gameObject.layer = LayerMask.NameToLayer (KickStarter.settingsManager.navMeshLayer); } if (navMesh.GetComponent <Collider2D>() == null) { ACDebug.LogWarning ("A 2D Collider component must be attached to " + navMesh.gameObject.name + " for pathfinding to work - please attach one."); } }
override public float Run() { if (sceneSetting == SceneSetting.DefaultNavMesh) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles && hole != null) { NavigationMesh currentNavMesh = KickStarter.sceneSettings.navMesh; if (holeAction == InvAction.Add) { currentNavMesh.AddHole(hole); } else if (holeAction == InvAction.Remove) { currentNavMesh.RemoveHole(hole); } else if (holeAction == InvAction.Replace) { currentNavMesh.AddHole(hole); currentNavMesh.RemoveHole(replaceHole); } } else if (newNavMesh != null) { NavigationMesh oldNavMesh = KickStarter.sceneSettings.navMesh; oldNavMesh.TurnOff(); newNavMesh.TurnOn(); KickStarter.sceneSettings.navMesh = newNavMesh; // Bugfix: Need to cycle this otherwise weight caching doesn't always work newNavMesh.TurnOff(); newNavMesh.TurnOn(); if (newNavMesh.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new NavMesh with no ConstantID - change will not be recognised by saved games."); } } } else if (sceneSetting == SceneSetting.DefaultPlayerStart && playerStart) { KickStarter.sceneSettings.defaultPlayerStart = playerStart; if (playerStart.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new default PlayerStart with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.SortingMap && sortingMap) { KickStarter.sceneSettings.sortingMap = sortingMap; KickStarter.sceneSettings.UpdateAllSortingMaps(); if (sortingMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new SortingMap with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.TintMap && tintMap) { KickStarter.sceneSettings.tintMap = tintMap; // Reset all FollowSortingMap components FollowTintMap[] followTintMaps = FindObjectsOfType(typeof(FollowTintMap)) as FollowTintMap[]; foreach (FollowTintMap followTintMap in followTintMaps) { followTintMap.ResetTintMap(); } if (tintMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new TintMap with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.OnLoadCutscene) { KickStarter.sceneSettings.cutsceneOnLoad = cutscene; if (cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Load with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.OnStartCutscene) { KickStarter.sceneSettings.cutsceneOnStart = cutscene; if (cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Start with no ConstantID - change will not be recognised by saved games."); } } return(0f); }
override public float Run() { if (sceneSetting == SceneSetting.DefaultNavMesh) { if (sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles && hole != null) { NavigationMesh currentNavMesh = sceneSettings.navMesh; if (holeAction == InvAction.Add) { currentNavMesh.AddHole(hole); } else if (holeAction == InvAction.Remove) { currentNavMesh.RemoveHole(hole); } else if (holeAction == InvAction.Replace) { currentNavMesh.AddHole(hole); currentNavMesh.RemoveHole(replaceHole); } } else if (newNavMesh != null) { NavigationMesh oldNavMesh = sceneSettings.navMesh; oldNavMesh.TurnOff(); newNavMesh.TurnOn(); sceneSettings.navMesh = newNavMesh; // Bugfix: Need to cycle this otherwise weight caching doesn't always work newNavMesh.TurnOff(); newNavMesh.TurnOn(); if (newNavMesh.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new NavMesh with no ConstantID - change will not be recognised by saved games.", newNavMesh); } } // Recalculate pathfinding characters foreach (Char _character in KickStarter.stateHandler.Characters) { _character.RecalculateActivePathfind(); } } else if (sceneSetting == SceneSetting.DefaultPlayerStart && playerStart) { sceneSettings.defaultPlayerStart = playerStart; if (playerStart.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new default PlayerStart with no ConstantID - change will not be recognised by saved games.", playerStart); } } else if (sceneSetting == SceneSetting.SortingMap && sortingMap) { sceneSettings.sortingMap = sortingMap; sceneSettings.UpdateAllSortingMaps(); if (sortingMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new SortingMap with no ConstantID - change will not be recognised by saved games.", sortingMap); } } else if (sceneSetting == SceneSetting.TintMap && tintMap) { sceneSettings.tintMap = tintMap; // Reset all FollowSortingMap components FollowTintMap[] followTintMaps = FindObjectsOfType(typeof(FollowTintMap)) as FollowTintMap[]; foreach (FollowTintMap followTintMap in followTintMaps) { followTintMap.ResetTintMap(); } if (tintMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new TintMap with no ConstantID - change will not be recognised by saved games.", tintMap); } } else if (sceneSetting == SceneSetting.OnLoadCutscene) { sceneSettings.cutsceneOnLoad = cutscene; if (sceneSettings.actionListSource == ActionListSource.AssetFile) { ACDebug.LogWarning("Warning: As the Scene Manager relies on asset files for its cutscenes, changes made with the 'Scene: Change setting' Action will not be felt."); } else if (cutscene != null && cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Load with no ConstantID - change will not be recognised by saved games.", cutscene); } } else if (sceneSetting == SceneSetting.OnStartCutscene) { sceneSettings.cutsceneOnStart = cutscene; if (sceneSettings.actionListSource == ActionListSource.AssetFile) { ACDebug.LogWarning("Warning: As the Scene Manager relies on asset files for its cutscenes, changes made with the 'Scene: Change setting' Action will not be felt."); } else if (cutscene != null && cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Start with no ConstantID - change will not be recognised by saved games.", cutscene); } } return(0f); }
public override void ResetHoles(NavigationMesh navMesh) { if (navMesh == null || navMesh.GetComponent <MeshCollider>() == null || navMesh.GetComponent <MeshCollider>().sharedMesh == null) return; if (navMesh.GetComponent <MeshFilter>() && navMesh.GetComponent <MeshFilter>().sharedMesh) { navMesh.GetComponent <MeshCollider>().sharedMesh = navMesh.GetComponent <MeshFilter>().sharedMesh; ACDebug.LogWarning (navMesh.gameObject.name + " has no MeshCollider mesh - temporarily using MeshFilter mesh instead."); } else { ACDebug.LogWarning (navMesh.gameObject.name + " has no MeshCollider mesh."); } }