Esempio n. 1
0
        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
                                           string[] movedFromAssetPaths)
        {
            foreach (string str in importedAssets)
            {
                if (str.IndexOf("/const.csv", StringComparison.Ordinal) != -1)
                {
                    TextAsset data      = AssetDatabase.LoadAssetAtPath <TextAsset>(str);
                    string    assetFile = str.Replace(".csv", ".asset");
                    ConstData gm        = AssetDatabase.LoadAssetAtPath <ConstData>(assetFile);
                    if (gm == null)
                    {
                        gm = ScriptableObject.CreateInstance <ConstData>();
                        AssetDatabase.CreateAsset(gm, assetFile);
                    }

                    ConstData readData = CsvReader.DeserializeIdValue <ConstData>(data.text);
                    EditorUtility.CopySerialized(readData, gm);

                    EditorUtility.SetDirty(gm);
                    AssetDatabase.SaveAssets();
                    Debug.Log("Reimport Asset: " + str);
                }
            }
        }