Skip to content

GimChuang/UnityFileIOUtility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnityFileIOUtility

FileIOUtility.cs is a simple script helps process file I/O in Unity. There is a Test_FileIOUtility sample scene showing how to use this script.

How to Use

FileIOUtility is a public static class so you can simply access it from any other scripts.

Scripting Reference

public static string GenerateFileName(string _prefix, int _index, FileExtension _extension)

generates a filename with your disired prefix string, index (useful for counting players in my case), file extension(currently I need only png and jpg) and system date time. For instance, calling GenerateFileName("MyPicture", 23, FileExtension.PNG) returns "MyPicture_00012_03-28_21-02-30.png".

public static void SaveImage(Texture2D _texture, string _path, string _fileName, FileExtension _extension)

saves a Texture2D with specified filename and extension to a path.

public static bool DoesPathExist(string _path)

checks if a path exists.

 public static bool IsFileLocked(string _filePath)

checks if a file is locked. (The file may be unavailable because it is still be written to, or being processed by another thread, or does not exist. This is from nikunjM's answer on Stack Overflow)

Note

This project use Git submodule gm_FileIOUtility. You need to call

git clone --recurse-submodules <URL>

when you clone this reposiory.

About

Simple scripts to process file I/O in Unity.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages