private void InitNewConfig() { Debug.Log("Reset Event Builder Config!"); this.config = ScriptableObject.CreateInstance <GameEventsConfig>(); //添加几个默认事件组 var gameGruop = new GameEventGroup("Game"); config.groups.Add(gameGruop); var uiGroup = new GameEventGroup("UI"); config.groups.Add(uiGroup); this.groupNames = GetGroupNames(); }
private void LoadConfig() { string folderPath = "Assets/Resources/GameEventBuilder"; if (AssetDatabase.IsValidFolder(folderPath) == false) { AssetDatabase.CreateFolder("Assets", "GameEventBuilder"); AssetDatabase.MoveAsset("Assets/GameEventBuilder", "Assets/Resources/GameEventBuilder"); this.InitNewConfig(); this.SaveConfig(); } else { string loadPath = folderPath + "/EventBuilderConfig.asset"; this.config = AssetDatabase.LoadAssetAtPath <GameEventsConfig>(loadPath); if (config == null) { this.InitNewConfig(); this.SaveConfig(); } this.groupNames = GetGroupNames(); } }