Exemple #1
0
        /// <summary>
        /// Sets the save to be in a custom folder.
        /// </summary>
        public static HUMIO.Data.Custom Custom(this HUMIO.Data.Save saveData, string filePath, string fileName)
        {
            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }

            return(new HUMIO.Data.Custom(filePath + fileName, saveData, new HUMIO.Data.Load()));
        }
Exemple #2
0
        /// <summary>
        /// Sets the save to be in the persistant data path.
        /// </summary>
        public static HUMIO.Data.Persistant Persistant(this HUMIO.Data.Save saveData, string fileName)
        {
            var path = HUMIO.PersistantPath();

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            return(new HUMIO.Data.Persistant(path, saveData, new HUMIO.Data.Load()));
        }
Exemple #3
0
        /// <summary>
        /// Saves an asset at path. Optionally you can immediately refresh the database after saving.
        /// </summary>
        public static void Asset(this HUMIO.Data.Save saveData, string path, bool refresh = false)
        {
            if (saveData.value.GetType() == typeof(GameObject))
            {
                UnityEditor.PrefabUtility.SaveAsPrefabAsset(saveData.value as GameObject, path);
            }
            else
            {
                UnityEditor.AssetDatabase.CreateAsset(saveData.value as UnityEngine.Object, path);
            }

            if (refresh)
            {
                saveData.And().Refresh();
            }
        }
Exemple #4
0
 /// <summary>
 /// When saving, also do an accompanied action.
 /// </summary>
 public static HUMIO.Data.And And(this HUMIO.Data.Save saveData)
 {
     return(new HUMIO.Data.And());
 }