Table of Contents

Class ResourceSystem

Namespace
Ceres.Resource
Assembly
Ceres.dll

Resource system that loads resource by address and label based on Addressables.

public static class ResourceSystem
Inheritance
ResourceSystem
Inherited Members

Fields

DynamicLoadPath

Dynamic load path placeholder for content catalog

public const string DynamicLoadPath = "{DYNAMIC_LOCAL_PATH}"

Field Value

string

Methods

EnsureAssetExistsAsync<TAsset>(IEnumerable, MergeMode)

Ensure resource location exists asynchronously. Throws InvalidResourceRequestException if not found.

public static UniTask EnsureAssetExistsAsync<TAsset>(IEnumerable key, ResourceSystem.MergeMode mergeMode)

Parameters

key IEnumerable
mergeMode ResourceSystem.MergeMode

Returns

UniTask

Type Parameters

TAsset

EnsureAssetExistsAsync<TAsset>(object)

Ensure resource location exists asynchronously. Throws InvalidResourceRequestException if not found.

public static UniTask EnsureAssetExistsAsync<TAsset>(object key)

Parameters

key object

Returns

UniTask

Type Parameters

TAsset

EnsureAssetExists<TAsset>(IEnumerable, MergeMode)

Ensure resource location exists. Throws InvalidResourceRequestException if not found.

public static void EnsureAssetExists<TAsset>(IEnumerable key, ResourceSystem.MergeMode mergeMode)

Parameters

key IEnumerable
mergeMode ResourceSystem.MergeMode

Type Parameters

TAsset

EnsureAssetExists<TAsset>(object)

Ensure resource location exists. Throws InvalidResourceRequestException if not found.

public static void EnsureAssetExists<TAsset>(object key)

Parameters

key object

Type Parameters

TAsset

GetAwaiter(ResourceHandle)

public static UniTask.Awaiter GetAwaiter(this ResourceHandle handle)

Parameters

handle ResourceHandle

Returns

UniTask.Awaiter

GetAwaiter<T>(ResourceHandle<T>)

public static UniTask<T>.Awaiter GetAwaiter<T>(this ResourceHandle<T> handle)

Parameters

handle ResourceHandle<T>

Returns

UniTask<T>.Awaiter

Type Parameters

T

GetCatalogExtension()

public static string GetCatalogExtension()

Returns

string

InstantiateAsync(string, Transform, Action<GameObject>)

Instantiate a single GameObject async

public static ResourceHandle<GameObject> InstantiateAsync(string address, Transform parent = null, Action<GameObject> callback = null)

Parameters

address string

The key of the location of the Object to instantiate.

parent Transform

Parent transform for instantiated object.

callback Action<GameObject>

Callback on instantiate complete

Returns

ResourceHandle<GameObject>

IsDone(ResourceHandle)

Whether internal operation is done

public static bool IsDone(this ResourceHandle handle)

Parameters

handle ResourceHandle

Returns

bool

IsDone<T>(ResourceHandle<T>)

Whether internal operation is done

public static bool IsDone<T>(this ResourceHandle<T> handle)

Parameters

handle ResourceHandle<T>

Returns

bool

Type Parameters

T

IsValid(ResourceHandle)

Whether internal operation is valid

public static bool IsValid(this ResourceHandle handle)

Parameters

handle ResourceHandle

Returns

bool

IsValid<T>(ResourceHandle<T>)

Whether internal operation is valid

public static bool IsValid<T>(this ResourceHandle<T> handle)

Parameters

handle ResourceHandle<T>

Returns

bool

Type Parameters

T

LoadAssetAsync<T>(string, Action<T>)

Load asset async

public static ResourceHandle<T> LoadAssetAsync<T>(string address, Action<T> callBack = null)

Parameters

address string
callBack Action<T>

Returns

ResourceHandle<T>

Type Parameters

T

LoadAssetsAsync<T>(IEnumerable, MergeMode, Action<IList<T>>)

public static ResourceHandle<IList<T>> LoadAssetsAsync<T>(IEnumerable key, ResourceSystem.MergeMode mode, Action<IList<T>> callBack = null)

Parameters

key IEnumerable
mode ResourceSystem.MergeMode
callBack Action<IList<T>>

Returns

ResourceHandle<IList<T>>

Type Parameters

T

LoadAssetsAsync<T>(object, Action<IList<T>>)

public static ResourceHandle<IList<T>> LoadAssetsAsync<T>(object key, Action<IList<T>> callBack = null)

Parameters

key object
callBack Action<IList<T>>

Returns

ResourceHandle<IList<T>>

Type Parameters

T

LoadCatalog(string)

Load Addressables content catalog from path.

public static bool LoadCatalog(string path)

Parameters

path string

Can be folder path or catalog path

Returns

bool

LoadCatalogAsync(string)

Load Addressables content catalog asynchronously from path.

public static UniTask<bool> LoadCatalogAsync(string path)

Parameters

path string

Can be folder path or catalog path

Returns

UniTask<bool>

Release(ResourceHandle)

Release resource

public static void Release(ResourceHandle handle)

Parameters

handle ResourceHandle

ReleaseAsset(ResourceHandle)

Release Asset, should align with LoadAssetAsync<T>(string, Action<T>)

public static void ReleaseAsset(ResourceHandle handle)

Parameters

handle ResourceHandle

ReleaseInstance(GameObject)

Release GameObject Instance, should align with InstantiateAsync(string, Transform, Action<GameObject>)

public static void ReleaseInstance(GameObject gameObject)

Parameters

gameObject GameObject

Release<T>(ResourceHandle<T>)

Release resource

public static void Release<T>(ResourceHandle<T> handle)

Parameters

handle ResourceHandle<T>

Type Parameters

T

ToResourceHandle<T>(AssetReferenceT<T>)

Load asset async by UnityEngine.AddressableAssets.AssetReferenceT<TObject> and convert to ResourceHandle<T>

public static ResourceHandle<T> ToResourceHandle<T>(this AssetReferenceT<T> assetReferenceT) where T : Object

Parameters

assetReferenceT AssetReferenceT<T>

Returns

ResourceHandle<T>

Type Parameters

T

ToUniTask(ResourceHandle)

public static UniTask ToUniTask(this ResourceHandle handle)

Parameters

handle ResourceHandle

Returns

UniTask

ToUniTask<T>(ResourceHandle<T>)

public static UniTask<T> ToUniTask<T>(this ResourceHandle<T> handle)

Parameters

handle ResourceHandle<T>

Returns

UniTask<T>

Type Parameters

T

WithCancellation(ResourceHandle, CancellationToken, bool, bool)

public static UniTask WithCancellation(this ResourceHandle handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)

Parameters

handle ResourceHandle
cancellationToken CancellationToken
cancelImmediately bool
autoReleaseWhenCanceled bool

Returns

UniTask

WithCancellation<T>(ResourceHandle<T>, CancellationToken, bool, bool)

public static UniTask<T> WithCancellation<T>(this ResourceHandle<T> handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)

Parameters

handle ResourceHandle<T>
cancellationToken CancellationToken
cancelImmediately bool
autoReleaseWhenCanceled bool

Returns

UniTask<T>

Type Parameters

T