UnityEditor.GameObjectUtility.GetNavMeshArea C# (CSharp) Method

GetNavMeshArea() private method

private GetNavMeshArea ( GameObject go ) : int
go UnityEngine.GameObject
return int
        public static extern int GetNavMeshArea(GameObject go);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]

Usage Example

        private static void ObjectSettings(Object[] components, GameObject[] gos)
        {
            ComponentBasedWorkflowButton();

            EditorGUILayout.MultiSelectionObjectTitleBar(components);

            using (var so = new SerializedObject(gos))
            {
                using (new EditorGUI.DisabledScope(!SceneModeUtility.StaticFlagField("Navigation Static", so.FindProperty("m_StaticEditorFlags"), (int)StaticEditorFlags.NavigationStatic)))
                {
                    SceneModeUtility.StaticFlagField("Generate OffMeshLinks", so.FindProperty("m_StaticEditorFlags"), (int)StaticEditorFlags.OffMeshLinkGeneration);

                    var property = so.FindProperty("m_NavMeshLayer");

                    EditorGUI.BeginChangeCheck();
                    EditorGUI.showMixedValue = property.hasMultipleDifferentValues;
                    var navAreaNames         = GameObjectUtility.GetNavMeshAreaNames();
                    var currentAbsoluteIndex = GameObjectUtility.GetNavMeshArea(gos[0]);

                    var navAreaIndex = -1;

                    // Need to find the index as the list of names will compress out empty area
                    for (var i = 0; i < navAreaNames.Length; i++)
                    {
                        if (GameObjectUtility.GetNavMeshAreaFromName(navAreaNames[i]) == currentAbsoluteIndex)
                        {
                            navAreaIndex = i;
                            break;
                        }
                    }

                    var navMeshArea = EditorGUILayout.Popup("Navigation Area", navAreaIndex, navAreaNames);
                    EditorGUI.showMixedValue = false;

                    if (EditorGUI.EndChangeCheck())
                    {
                        //Convert the selected index into absolute index...
                        var newNavAreaIndex = GameObjectUtility.GetNavMeshAreaFromName(navAreaNames[navMeshArea]);

                        GameObjectUtility.ShouldIncludeChildren includeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(Selection.gameObjects,
                                                                                                                                        "Change Navigation Area", "Do you want change the navigation area to " + navAreaNames[navMeshArea] + " for all the child objects as well?");
                        if (includeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel)
                        {
                            property.intValue = newNavAreaIndex;
                            SetNavMeshArea(newNavAreaIndex, includeChildren == 0);
                        }
                    }
                }

                so.ApplyModifiedProperties();
            }
        }
All Usage Examples Of UnityEditor.GameObjectUtility::GetNavMeshArea