Exemple #1
0
        public static void Save(ChartEditorSave save)
        {
            Assert.IsNotNull(save);
            string folderPath = Path.Combine(assets, resources);

            if (!AssetDatabase.IsValidFolder(folderPath))
            {
                AssetDatabase.CreateFolder(assets, resources);
            }
            string assetPath = Path.Combine(folderPath, assetNameWithExtension);

            if (IOHelpers.AssetExists(assetName, folderPath))
            {
                AssetDatabase.DeleteAsset(assetPath);
            }
            AssetDatabase.CreateAsset(save, assetPath);
            AssetDatabase.SaveAssets();
        }
        public static void Save(NodeEditorSave save)
        {
            Assert.IsNotNull(save);
            Assert.IsTrue(save.Nodes.All(node => node != null));
            string folderPath = Path.Combine(assets, resources);

            if (!AssetDatabase.IsValidFolder(folderPath))
            {
                AssetDatabase.CreateFolder(assets, resources);
            }
            string assetPath = Path.Combine(folderPath, assetNameWithExtension);

            if (IOHelpers.AssetExists(assetName, folderPath))
            {
                AssetDatabase.DeleteAsset(assetPath);
            }
            AssetDatabase.CreateAsset(save, assetPath);
            //save = save.CopyDeep();
            //ScriptableObjectHelpers.SaveCompoundScriptableObject(save, assetPath);
            EditorPrefs.SetBool(loadKey, true);
            AssetDatabase.SaveAssets();
        }