public override void OnInspectorGUI() { PKFxSettings settings = (PKFxSettings)target; PKFxSettings.SetInstance(settings); using (var category = new PKFxEditorCategory(() => EditorGUILayout.Foldout(PKFxSettings.GeneralCategory, "General"))) { PKFxSettings.GeneralCategory = category.IsExpanded(); if (category.IsExpanded()) { DisplayGeneralCategory(); } } using (var category = new PKFxEditorCategory(() => EditorGUILayout.Foldout(PKFxSettings.RenderingCategory, "Rendering"))) { PKFxSettings.RenderingCategory = category.IsExpanded(); if (category.IsExpanded()) { DisplayRenderingCategory(); } } using (var category = new PKFxEditorCategory(() => EditorGUILayout.Foldout(PKFxSettings.ThreadingCategory, "Multithreading"))) { PKFxSettings.ThreadingCategory = category.IsExpanded(); if (category.IsExpanded()) { DisplayThreadingCategory(); } } if (PKFxSettings.EnableFileLog != PKFxManagerImpl.FileLoggingEnabled()) { EditorGUILayout.HelpBox("At least one of the changes requires a restart of Unity to be effective.", MessageType.Warning, true); } if (GUI.changed) { EditorUtility.SetDirty(settings); } }
void OnDisable() { // make sure the runtime code will load the Asset from Resources when it next tries to access this. PKFxSettings.SetInstance(null); }