Пример #1
0
        /// <summary>
        /// Deletes a file in the persistant data path.
        /// </summary>
        public static void Persistant(this HUMIO.Data.Delete deleteData, string fileName)
        {
            var path = HUMIO.PersistantPath(fileName);

            if (File.Exists(path))
            {
                File.Delete(path);
            }
        }
Пример #2
0
        public static GameObject SavePrefabAndSelect(string path, GameObject root)
        {
            HUMIO.Ensure(path);
            var prefabPath = path + ((path[path.Length - 1].ToString() == "/") ? string.Empty : "/") + root.name + ".prefab";

            HUMIO.Save(root).Asset(prefabPath, true);
            GameObject.DestroyImmediate(root);
            Selection.activeObject = AssetDatabase.LoadAssetAtPath <GameObject>(prefabPath);
            return(Selection.activeGameObject);
        }
Пример #3
0
        /// <summary>
        /// Copies a file from the persistant data path, into the persistant data path, with a new file name;
        /// </summary>
        public static void Persistant(this HUMIO.Data.Copy copyData, string fileName, string newFileName)
        {
            var path    = HUMIO.PersistantPath(fileName);
            var newPath = HUMIO.PersistantPath(newFileName);

            if (File.Exists(path))
            {
                File.Copy(path, newPath);
            }
        }
Пример #4
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()));
        }