public static void ValidateState(UnitySocialSettings settings)
        {
            bool isValid = false;

            if (settings != null && settings.isValid)
            {
                isValid = true;
            }

            UnitySocialPostprocessor.SetScriptingDefineSymbolForTarget(BuildTargetGroup.iOS, "UNITY_SOCIAL", isValid ? settings.iosSupportEnabled : false);
            UnitySocialPostprocessor.SetScriptingDefineSymbolForTarget(BuildTargetGroup.Android, "UNITY_SOCIAL", isValid ? settings.androidSupportEnabled : false);
        }
        public override void OnInspectorGUI()
        {
            try
            {
                // Might be null when this gui is open and this file is being reimported
                if (target == null)
                {
                    Selection.activeObject = null;
                    return;
                }

                m_CurrentSettings = (UnitySocialSettings)target;

                if (m_CurrentSettings != null)
                {
                    bool settingsValid = m_CurrentSettings.isValid;

                    EditorGUILayout.HelpBox("1) Enter your game credentials", MessageType.None);

                    if (!m_CurrentSettings.isValid)
                    {
                        EditorGUILayout.HelpBox("Invalid or missing game credentials, Unity Social disabled.", MessageType.Error);
                    }

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(s_LabelClientId, GUILayout.Width(108), GUILayout.Height(18));
                    string newClientId = TrimmedText(EditorGUILayout.TextField(m_CurrentSettings.clientId));
                    if (m_CurrentSettings.clientId != newClientId)
                    {
                        m_CurrentSettings.clientId = newClientId;
                        GameServicesEditor.BakeGameServicesData();
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.HelpBox("2) Enable Unity Social on these platforms", MessageType.None);

                    EditorGUILayout.BeginVertical();

                    bool validityChanged          = m_CurrentSettings.isValid != settingsValid;
                    bool selectedPlatformsChanged = false;

                    m_IOSSupportEnabled     = EditorGUILayout.Toggle(s_LabelSupport_iOS, m_CurrentSettings.iosSupportEnabled);
                    m_AndroidSupportEnabled = EditorGUILayout.Toggle(s_LabelSupport_Android, m_CurrentSettings.androidSupportEnabled);

                    if (GUILayout.Button("Refresh Baked Game Services Data"))
                    {
                        GameServicesEditor.BakeGameServicesData();
                    }

                    if (m_IOSSupportEnabled != m_CurrentSettings.iosSupportEnabled)
                    {
                        selectedPlatformsChanged            = true;
                        m_CurrentSettings.iosSupportEnabled = m_IOSSupportEnabled;

                        if (m_IOSSupportEnabled)
                        {
                            FixiOSVersion();
                        }

                        GameServicesEditor.BakeGameServicesData();
                        EditorUtility.SetDirty(m_CurrentSettings);
                    }
                    else if (m_AndroidSupportEnabled != m_CurrentSettings.androidSupportEnabled)
                    {
                        EnableAndroidSupport(m_AndroidSupportEnabled);
                        UnitySocialAndroidDependencies.SetAndroidManifestConfig(m_CurrentSettings);
                        selectedPlatformsChanged = true;
                        m_CurrentSettings.androidSupportEnabled = m_AndroidSupportEnabled;

                        GameServicesEditor.BakeGameServicesData();
                        if (m_AndroidSupportEnabled)
                        {
                            AndroidSdkVersions sdkVer = PlayerSettings.Android.minSdkVersion;

                            if (sdkVer < AndroidSdkVersions.AndroidApiLevel16)
                            {
                                PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel16;
                                Debug.Log("Unity Social requires minimum Android API level 16. API minSdkVersion updated to 16.");
                            }
                        }

                        EditorUtility.SetDirty(m_CurrentSettings);
                    }

                    if (m_AndroidSupportEnabled)
                    {
                        AndroidPushNotificationSettings();

                        if (GUILayout.Button("Force Import Android dependencies"))
                        {
                            UnitySocialAndroidDependencies.PlayServicesImport();
                        }
                    }

                    if (validityChanged || selectedPlatformsChanged)
                    {
                        UnitySocialPostprocessor.ValidateState(m_CurrentSettings);
                    }

                    EditorGUILayout.EndVertical();
                }
            }
            catch (Exception)
            {
            }
        }