public override void OnInspectorGUI()

in SupportingScripts/Editor/Scripts/MapSessionEditor.cs [43:167]


        public override void OnInspectorGUI()
        {
            Initialize();

            serializedObject.UpdateIfRequiredOrScript();

            var overrideRegion = !_autodetectRegion || !string.IsNullOrWhiteSpace(_regionOverrideProperty.stringValue);
            _autodetectRegion = !overrideRegion;

            // This should just be done one time.
            {
                var mapSession = target as MapSession;
                var components = mapSession.gameObject.GetComponents<Component>();

                var mapRendererIndex = -1;
                for (var i = 0; i < components.Length; i++)
                {
                    if (components[i] is MapRenderer)
                    {
                        mapRendererIndex = i;
                        break;
                    }
                }

                var mapSessionIndex = -1;
                for (var i = 0; i < components.Length; i++)
                {
                    if (components[i] is MapSession)
                    {
                        mapSessionIndex = i;
                        break;
                    }
                }

                if (mapSessionIndex > mapRendererIndex)
                {
                    var delta = mapSessionIndex - mapRendererIndex;
                    while (delta > 0)
                    {
                        UnityEditorInternal.ComponentUtility.MoveComponentUp(mapSession);
                        delta--;
                    }
                }
            }

            RenderBanner();

            // Setup and key.
            _developerKeyProperty.stringValue = EditorGUILayout.PasswordField("Developer Key", _developerKeyProperty.stringValue);
            if (string.IsNullOrWhiteSpace(_developerKeyProperty.stringValue))
            {
                EditorGUI.indentLevel++;
                Help(
                    "Provide a developer key to enable Bing Maps services.",
                    "Sign up for a key at the Bing Maps Dev Center.",
                    "https://www.bingmapsportal.com/");
                EditorGUI.indentLevel--;
            }

            _showMapDataInEditorProperty.boolValue =
                EditorGUILayout.Toggle(
                    new GUIContent(
                        "Show Map Data in Editor",
                        "Map data usage in the editor will apply to the specified developer key."),
                    _showMapDataInEditorProperty.boolValue);

            EditorGUI.indentLevel++;

            // Localization
            EditorGUILayout.BeginVertical(_boxStyle);
            _showLocalizationOptions = EditorGUILayout.Foldout(_showLocalizationOptions, "Localization", true, _foldoutTitleStyle);
            if (_showLocalizationOptions)
            {
                _autodetectRegion = EditorGUILayout.Toggle("Autodetect Region", _autodetectRegion);
                EditorGUI.BeginDisabledGroup(_autodetectRegion);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(_regionOverrideProperty);
                EditorGUI.indentLevel--;
                EditorGUI.EndDisabledGroup();

                if (_autodetectRegion)
                {
                    _regionOverrideProperty.stringValue = string.Empty;
                }

                var previousIsLanguageAutoDetected = _languageOverrideProperty.intValue == (int)SystemLanguage.Unknown;
                var newIsLanguageAutoDetected = EditorGUILayout.Toggle("Autodetect Language", previousIsLanguageAutoDetected);

                // If we are switching from autodetected to override, initialize override property with the current system language.
                if (!newIsLanguageAutoDetected && previousIsLanguageAutoDetected)
                {
                    _languageOverrideProperty.intValue = (int)Application.systemLanguage;
                }

                // If we are switching from overridden to autodetected, clear the override property to unknown.
                if (newIsLanguageAutoDetected && !previousIsLanguageAutoDetected)
                {
                    _languageOverrideProperty.intValue = (int)SystemLanguage.Unknown;
                }

                EditorGUI.indentLevel++;
                if (newIsLanguageAutoDetected)
                {
                    EditorGUI.BeginDisabledGroup(true);
                    EditorGUILayout.EnumPopup("Language", Application.systemLanguage);
                    EditorGUI.EndDisabledGroup();
                }
                else
                {
                    EditorGUILayout.PropertyField(_languageOverrideProperty, new GUIContent("Language"));
                }
                EditorGUI.indentLevel--;

                GUILayout.Space(4);
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(12);
                EditorGUILayout.PropertyField(_languageChangedProperty);
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();

            EditorGUI.indentLevel--;

            serializedObject.ApplyModifiedProperties();
        }