private static void SetNavMeshArea(int area, bool includeChildren) { List <GameObject> objects = NavMeshEditorWindow.GetObjects(includeChildren); if (objects.Count > 0) { Undo.RecordObjects(objects.ToArray(), "Change NavMesh area"); foreach (GameObject current in objects) { GameObjectUtility.SetNavMeshArea(current, area); } } }
private static void SetNavMeshArea(int area, bool includeChildren) { List <GameObject> objects = NavMeshEditorWindow.GetObjects(includeChildren); if (objects.Count <= 0) { return; } Undo.RecordObjects((UnityEngine.Object[])objects.ToArray(), "Change NavMesh area"); using (List <GameObject> .Enumerator enumerator = objects.GetEnumerator()) { while (enumerator.MoveNext()) { GameObjectUtility.SetNavMeshArea(enumerator.Current, area); } } }