Utilities Class

Definition

Helper Utilities methods used by other classes.

C++
public ref class Utilities abstract sealed
Inheritance
Utilities

Fields

Properties

Methods

CopyDirectory(String, String)

Copies the source directory to the output directory creating all the directories first then copying.

DeleteDirectory(String, Boolean)

Delete directory helper that also waits for delete to completely propagate through the system.

EnsureCleanDirectory(String)

Deletes a directory then waits for it to be flushed in the system as deleted before creating. Sometimes deleting and creating to quickly will result in an exception.

GetAssetLocation(FileInfo)

Gets the known AssetLocation for the asset file.

GetAssetsRelativePathFrom(String)

Get a path relative to the assets folder from the absolute path.

GetBuildTargetGroup(BuildTarget)

Gets a BuildTargetGroup for a specified BuildTarget.

GetFullPathFromAssetsRelative(String)

Converts an assets relative path to an absolute path.

GetFullPathFromKnownRelative(String)

Gets a full path from one of the two known relative paths (Assets, Packages). Packages is converted to use PackagesCopy.

GetFullPathFromPackagesRelative(String)

Converts a Packages relative path to an absolute path using PackagesCopy directory instead.

GetNormalizedPath(String, Boolean)

Gets a normalized path (with back slashes only), and optionally can make full path.

GetPackagesRelativePathFrom(String)

Get a path relative to the Packages folder from the absolute path, uses PackagesOutput folder.

GetPathsFromGuidsInPlace(String[], Boolean)

Given a list of Asset guids converts them to asset paths in place.

GetRelativePath(String, String)

Gets a relative path between two absolute paths.

GetRelativePathForKnownFolders(String, String)

Gets a relative path between two known relative paths (inside Assets or Packages)

GetUWPSDKs()
IsManagedAssembly(String)

A helper to check whether a DLL is a managed assembly.

IsPlatformInstalled(BuildTarget)

Helper to see if the specified BuildTarget is installed in the editor.

ReadUntil(StreamReader, String[])

Reads until some contents is encountered, or the end of the stream is reached.

ReadWhile(StreamReader, Func<String,Boolean>)

Reads while the predicate is satisfied, returns the line on which it failed.

ReplaceTokens(String, Dictionary<String,String>, Boolean)

Helper to replace tokens in text using StringBuilder.

TryGetGuidForAsset(FileInfo, Guid)

Parses a .meta file to extract a guid for the asset.

TryGetTextTemplate(String, String, String, String)

Helper to fetch a normal text file based template ('prefixed with #')

TryGetTextTemplate(String, String, String)

Helper to fetch a normal text file based template ('prefixed with #')

TryGetXMLTemplate(String, String, String)

Helper to fetch an XML based template.

TryIOWithRetries(Action, Int32, TimeSpan, Boolean)

Helper to perform an IO operation with retries.

Applies to

Product Versions
MRTK2 Unity 2018 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0
MRTK2 Unity 2019 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0, 2.8.0
MRTK2 Unity 2020 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0, 2.8.0