UnityToolbox
Brief documentation for all existing scripts.
 
Loading...
Searching...
No Matches
UnityToolbox.General.Management.ResourcesUtil Class Reference

A utility which writes and reads data with correctly formatted paths.

Static Public Member Functions

static bool IsFullPathValid (string path)
 Checks whether the path is valid and defined with a "Resources" folder.
 
static bool TrySetValidPath (string fullPath, string key)
 Tries to define a path within the ProjectPrefs. The Application.dataPath will be removed from it.
 
static string GetLocalPath (string key)
 Builds the local path from the stored path within the ProjectPrefs.
 
static string GetResourcesPath (string key)
 Builds the "Resources" path from the stored path within the ProjectPrefs.
 
static string GetProjectPath (string key)
 Builds the project path from the stored path within the ProjectPrefs.
 
static T GetFileData< T > (string key, string filename)
 Reads a TextAsset with a key for the ProjectPrefs and the filename.
 
static void WriteFile (string key, string filename, object fileData)
 Writes an object to a file and refreshes the AssetDatabase.
 

Member Function Documentation

◆ GetFileData< T >()

static T UnityToolbox.General.Management.ResourcesUtil.GetFileData< T > ( string  key,
string  filename 
)
static
Parameters
keyThe key for the ProjectPrefs.
filenameThe filename.
Returns
The cast values of the file.

References UnityToolbox.General.Management.ResourcesUtil.GetLocalPath(), and UnityToolbox.General.Management.ResourcesUtil.GetResourcesPath().

◆ GetLocalPath()

static string UnityToolbox.General.Management.ResourcesUtil.GetLocalPath ( string  key)
static

◆ GetProjectPath()

static string UnityToolbox.General.Management.ResourcesUtil.GetProjectPath ( string  key)
static
Parameters
keyThe key for the ProjectPrefs.
Returns
A project directory.

References UnityToolbox.General.Preferences.ProjectPrefs.GetString().

◆ GetResourcesPath()

static string UnityToolbox.General.Management.ResourcesUtil.GetResourcesPath ( string  key)
static

◆ IsFullPathValid()

static bool UnityToolbox.General.Management.ResourcesUtil.IsFullPathValid ( string  path)
static

◆ TrySetValidPath()

static bool UnityToolbox.General.Management.ResourcesUtil.TrySetValidPath ( string  fullPath,
string  key 
)
static
Parameters
pathThe local path.
keyThe key for the ProjectPrefs.
Returns
Whether the path could be set.

References UnityToolbox.General.Management.ResourcesUtil.IsFullPathValid(), and UnityToolbox.General.Preferences.ProjectPrefs.SetString().

◆ WriteFile()

static void UnityToolbox.General.Management.ResourcesUtil.WriteFile ( string  key,
string  filename,
object  fileData 
)
static