void OnEnable() { changed = false; orig = (AudioAssetRule)target; importPanel = new AudioImportPanel(); importPanel.CurrentRule = orig; Undo.RecordObject(target, "assetruleundo"); }
private void initAllRules() { texturePanel = new TextureImportPanel(); modelPanel = new ModelImportPanel(); audioPanel = new AudioImportPanel(); settingPanel = new SettingPanel(); keyRules = new Dictionary <string, ABaseRule>(); folderRules = new Dictionary <string, List <ABaseRule> >(); string ruleFolders = ImportPreferences.RuleFolderPath; string[] files = Directory.GetFiles(ruleFolders, "*.asset", SearchOption.AllDirectories); for (int i = 0; i < files.Length; i++) { string relativePath = files[i].Replace(Application.dataPath, "Assets").Replace("\\", "/"); ABaseRule rule = AssetDatabase.LoadAssetAtPath <ABaseRule>(relativePath); if (rule == null) { continue; } for (int j = 0; j < rule.Folders.Length; j++) { List <ABaseRule> frs = null; if (!folderRules.TryGetValue(rule.Folders[j], out frs)) { frs = new List <ABaseRule>(); folderRules[rule.Folders[j]] = frs; } frs.Add(rule); } keyRules[rule.RuleKey] = rule; } }