public void ResetToDefaults()
        {
            UndoHandler.RegisterUndoableAction(this, "Reset To Defaults");

                        #if UNITY_EDITOR          // in UnityEditor use Presets or EditorJsonUtility
                        #if UNITY_2018_1_OR_NEWER // Presets were introduced in Unity 2018.1
                        #if UNITY_2019_3_OR_NEWER // GetDefaultForObject became obsolete in Unity 2019.3
            var presets = Preset.GetDefaultPresetsForObject(this);
            var preset  = presets.Length > 0 ? presets[0] : null;
                        #else
            var preset = Preset.GetDefaultForObject(this);
                        #endif

            // if no default preset has been assigned for preferences asset, then try finding a preset
            // in the same directory with the preferences asset
            if (preset == null)
            {
                var preferencesPath = AssetDatabase.GetAssetPath(this);
                var directoryPath   = FileUtility.GetParentDirectory(preferencesPath);
                var updateGuids     = AssetDatabase.FindAssets("t:Preset", ArrayExtensions.TempStringArray(directoryPath));
                for (int n = updateGuids.Length - 1; n >= 0; n--)
                {
                    var path = AssetDatabase.GUIDToAssetPath(updateGuids[n]);
                    preset = AssetDatabase.LoadAssetAtPath <Preset>(path);
                    if (!string.Equals(preset.GetTargetFullTypeName(), typeof(InspectorPreferences).FullName, StringComparison.OrdinalIgnoreCase))
                    {
                        preset = null;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (preset != null)
            {
                preset.ApplyTo(this);
            }
            else
                        #endif
            {
                var freshInstance = CreateInstance <InspectorPreferences>();
                var jsonString    = EditorJsonUtility.ToJson(freshInstance);
                Platform.Active.Destroy(freshInstance);
                EditorJsonUtility.FromJsonOverwrite(jsonString, this);
            }
                        #else
            // at runtime use JsonUtility to reset values to those of a freshly created instance
            var freshInstance = CreateInstance <InspectorPreferences>();
            var jsonString    = JsonUtility.ToJson(freshInstance);
            Platform.Active.Destroy(freshInstance);
            JsonUtility.FromJsonOverwrite(jsonString, this);
                        #endif

            setupDone         = false;
            isFirstOnValidate = true;

            if (Event.current != null)
            {
                Setup();
            }

            Platform.Active.SetDirty(this);

            if (onSettingsChanged != null)
            {
                onSettingsChanged(this);
            }
        }
        /// <summary>
        /// Gets all updates for InspectorPreferences.
        /// Update files should be located in the same directory as the PreferencesAsset inside
        /// a folder named "Updates"
        /// </summary>
        /// <param name="preferences"></param>
        /// <returns></returns>
        public static InspectorPreferencesUpdate[] GetAllUpdates([NotNull] InspectorPreferences preferences)
        {
            var preferencesPath = AssetDatabase.GetAssetPath(preferences);
            var directoryPath   = FileUtility.GetParentDirectory(preferencesPath);

            directoryPath = FileUtility.GetChildDirectory(directoryPath, "Updates");

            if (!AssetDatabase.IsValidFolder(directoryPath))
            {
                                #if DEV_MODE
                Debug.LogWarning(preferences.name + " had no Updates folder next to it.");
                                #endif
                return(ArrayPool <InspectorPreferencesUpdate> .ZeroSizeArray);
            }

            var updateGuids = AssetDatabase.FindAssets("t:InspectorPreferencesUpdate", ArrayExtensions.TempStringArray(directoryPath));
            int count       = updateGuids.Length;
            var results     = new InspectorPreferencesUpdate[count];

            for (int n = updateGuids.Length - 1; n >= 0; n--)
            {
                var updatePath = AssetDatabase.GUIDToAssetPath(updateGuids[n]);
                results[n] = AssetDatabase.LoadAssetAtPath <InspectorPreferencesUpdate>(updatePath);
            }

            return(results);
        }