static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string str in importedAssets) { if (str.IndexOf("/shop_group.csv", StringComparison.Ordinal) != -1) { TextAsset data = AssetDatabase.LoadAssetAtPath <TextAsset>(str); string assetFile = str.Replace(".csv", ".asset"); ShopGroupExample gm = AssetDatabase.LoadAssetAtPath <ShopGroupExample>(assetFile); if (gm == null) { gm = ScriptableObject.CreateInstance <ShopGroupExample>(); AssetDatabase.CreateAsset(gm, assetFile); } gm.shopGroups = CsvReader.Deserialize <ShopGroupExample.ShopGroup>(data.text); gm.shopDict.Clear(); foreach (var shopGroup in gm.shopGroups) { gm.shopDict.Add(shopGroup.groupId, shopGroup); } EditorUtility.SetDirty(gm); AssetDatabase.SaveAssets(); Debug.Log("Reimport Asset: " + str); } } }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string str in importedAssets) { if (str.IndexOf("/ranking.csv", StringComparison.Ordinal) != -1) { TextAsset data = AssetDatabase.LoadAssetAtPath <TextAsset>(str); string assetFile = str.Replace(".csv", ".asset"); RankingData gm = AssetDatabase.LoadAssetAtPath <RankingData>(assetFile); if (gm == null) { gm = ScriptableObject.CreateInstance <RankingData>(); AssetDatabase.CreateAsset(gm, assetFile); } var items = CsvReader.Deserialize <RankingData.Item>(data.text); gm.itemDict.Clear(); foreach (var item in items) { gm.itemDict.Add(item.ranking, item); } EditorUtility.SetDirty(gm); AssetDatabase.SaveAssets(); Debug.Log("Reimport Asset: " + str); } } }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string str in importedAssets) { if (str.IndexOf("/language.csv", StringComparison.Ordinal) != -1) { TextAsset data = AssetDatabase.LoadAssetAtPath <TextAsset>(str); string assetFile = str.Replace(".csv", ".asset"); LanguageDataExample gm = AssetDatabase.LoadAssetAtPath <LanguageDataExample>(assetFile); if (gm == null) { gm = ScriptableObject.CreateInstance <LanguageDataExample>(); AssetDatabase.CreateAsset(gm, assetFile); } var rows = CsvReader.Deserialize <RowData>(data.text, '~'); gm.data.Clear(); foreach (var row in rows) { gm.data.Add(row.key, row.value); } EditorUtility.SetDirty(gm); AssetDatabase.SaveAssets(); Debug.Log("Reimport Asset: " + str); } } }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string str in importedAssets) { if (str.IndexOf("/spawn_enemy.csv", StringComparison.Ordinal) != -1) { TextAsset data = AssetDatabase.LoadAssetAtPath <TextAsset>(str); string assetFile = str.Replace(".csv", ".asset"); SpawnEnemyExample gm = AssetDatabase.LoadAssetAtPath <SpawnEnemyExample>(assetFile); if (gm == null) { gm = ScriptableObject.CreateInstance <SpawnEnemyExample>(); AssetDatabase.CreateAsset(gm, assetFile); } gm.spawnEnemies = CsvReader.Deserialize <SpawnEnemyExample.SpawnEnemy>(data.text); EditorUtility.SetDirty(gm); AssetDatabase.SaveAssets(); Debug.Log("Reimport Asset: " + str); } } }