private static void ApplyPreferencesWhenAssetDatabaseReady() { if (!PreferencesApplier.ReadyToApplyPreferences()) { EditorApplication.delayCall += ApplyPreferencesWhenAssetDatabaseReady; return; } var classType = typeof(HierarchyFolderMenuItems); var preferences = HierarchyFolderPreferences.Get(); bool enabled = preferences.enableMenuItems; PreferencesApplier.ApplyPreferences(classType, new[] { "#define ENABLE_HIERARCHY_FOLDER_MENU_ITEMS" }, new[] { enabled }); preferences.onPreferencesChanged += (changedPreferences) => { if (changedPreferences.enableMenuItems != enabled) { var script = PreferencesApplier.FindScriptFile(classType); if (script != null) { AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(script)); } #if DEV_MODE else { Debug.LogWarning("Could not find script asset " + classType.Name + ".cs"); } #endif } }; }
private static void ApplyPreferencesWhenAssetDatabaseReady() { if (!PreferencesApplier.ReadyToApplyPreferences()) { EditorApplication.delayCall += ApplyPreferencesWhenAssetDatabaseReady; } else { PreferencesApplier.ApplyPreferences(typeof(HierarchyFolderExtensions), new[] { "#define HIERARCHY_FOLDER_EXTENSIONS_IN_GLOBAL_NAMESPACE" }, new[] { HierarchyFolderPreferences.Get().extensionMethodsInGlobalNamespace }); } }