3using System.Threading.Tasks;
12 private static int _threadStatusCheckDelay = 16;
16 public static int ThreadStatusCheckDelay {
get => _threadStatusCheckDelay;
set => _threadStatusCheckDelay = Mathf.Max(value, 1); }
23 public static async Task<T>
LoadAsync<T>(
string path,
string typeHint =
"",
bool useSubThreads =
false,
24 ResourceLoader.CacheMode cacheMode = ResourceLoader.CacheMode.Reuse) where T : Resource
26 var error = ResourceLoader.LoadThreadedRequest(path, typeHint, useSubThreads, cacheMode);
28 if (error != Error.Ok)
31 var status = ResourceLoader.LoadThreadedGetStatus(path);
33 while (status != ResourceLoader.ThreadLoadStatus.Loaded)
35 if (status != ResourceLoader.ThreadLoadStatus.InProgress)
39 status = ResourceLoader.LoadThreadedGetStatus(path);
42 return (T)ResourceLoader.LoadThreadedGet(path);
Contains methods for loading Resources asynchronously.
static async Task< T > LoadAsync< T >(string path, string typeHint="", bool useSubThreads=false, ResourceLoader.CacheMode cacheMode=ResourceLoader.CacheMode.Reuse)
Loads a Resource from file asynchronously.
static int ThreadStatusCheckDelay
The delay time in milliseconds between each resource load status check.
Raised if an error is encountered while loading a resource asynchronously.