Interface IAssetService
This service is used to load and unload assets. These assets can be anything from basic objects to prefabs and ScriptableObject data. Assets are stored under a provided key. This key can be passed through the various methods to help identify what assets to work with.
Inherited Members
Namespace: IdleKit.Core
Assembly: cs.temp.dll.dll
Syntax
public interface IAssetService : IService, IInjectable
Properties
NormalizedProgress
Returns the normalized (0 - 1) progress of the current load operation if it is loading assets.
Declaration
float NormalizedProgress { get; }
Property Value
Type | Description |
---|---|
Single |
Methods
AddAssets(String, IEnumerable<Object>)
Stores one or more assets under a key to be returned by a load operation.
Declaration
void AddAssets(string key, IEnumerable<object> assets)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key to store the assets under. A load operation that is passed the same key should return these assets. |
IEnumerable<Object> | assets | The assets to store. |
LoadAssetReferences<TAsset>(IEnumerable<IAssetReference<TAsset>>, Action<List<TAsset>>)
Loads one or more IAssetReference<TAsset> objects and returns the loaded assets in a callback.
Declaration
void LoadAssetReferences<TAsset>(IEnumerable<IAssetReference<TAsset>> assetReferences, Action<List<TAsset>> onComplete)
where TAsset : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IAssetReference<TAsset>> | assetReferences | The IAssetReference<TAsset> objects to load. |
Action<List<TAsset>> | onComplete | Broadcast when the assets have been loaded. |
Type Parameters
Name | Description |
---|---|
TAsset | The Type of asset contained in the AssetReferences. |
LoadAssets(String, Action<List<Object>>)
Loads one or more assets under a key and returns them in a callback.
Declaration
void LoadAssets(string key, Action<List<object>> onComplete)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key to load the assets from. |
Action<List<Object>> | onComplete | Broadcast when the assets have been loaded. |
LoadAssets(Type, String, Action<List<Object>>)
Loads one or more assets of a specific Type under a key and returns them in a callback. for a generic version of this method see LoadAssets<TResult>(String, Action<List<TResult>>)
Declaration
void LoadAssets(Type assetType, string key, Action<List<object>> onComplete)
Parameters
Type | Name | Description |
---|---|---|
Type | assetType | The Type of asset to load. |
String | key | The key to load the assets from. |
Action<List<Object>> | onComplete | Broadcast when the assets have been loaded. |
LoadAssets<TResult>(String, Action<List<TResult>>)
Loads one or more assets of a specific Type under a key and returns them in a callback. for a non-generic version of this method see LoadAssets(Type, String, Action<List<Object>>).
Declaration
void LoadAssets<TResult>(string key, Action<List<TResult>> onComplete)
where TResult : class
Parameters
Type | Name | Description |
---|---|---|
String | key | The key to load the assets from. |
Action<List<TResult>> | onComplete | Broadcast when the assets have been loaded. |
Type Parameters
Name | Description |
---|---|
TResult | The Type of asset to load. |
RemoveAllAssets()
Remove all assets.
Declaration
void RemoveAllAssets()
RemoveAssets(String, IEnumerable<Object>)
Removes one or more assets under a specific key that have previously been added so they can no longer be loaded.
Declaration
void RemoveAssets(string key, IEnumerable<object> assets)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key to remove the assets from under. |
IEnumerable<Object> | assets | The assets to remove. |
UnloadAllAssets()
Unload all assets.
Declaration
void UnloadAllAssets()
UnloadAssetReferences<TAsset>(IEnumerable<IAssetReference<TAsset>>)
Unloads one or more IAssetReference<TAsset> objects.
Declaration
void UnloadAssetReferences<TAsset>(IEnumerable<IAssetReference<TAsset>> assetReferences)
where TAsset : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IAssetReference<TAsset>> | assetReferences | The IAssetReference<TAsset> objects to unload. |
Type Parameters
Name | Description |
---|---|
TAsset | The Type of asset contained in the AssetReferences. |
UnloadAssets(String)
Unloads one or more assets.
Declaration
void UnloadAssets(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key to unload the assets from. |