Interface IAssetReference<TAsset>
An Asset Reference is meant to be used like a "load on demand" container for an asset. It should allow for easy asset assignment and loading / unloading. The referenced asset should not be loaded into memory until the load methods are used.
Namespace: IdleKit.Core
Assembly: cs.temp.dll.dll
Syntax
public interface IAssetReference<out TAsset>
Type Parameters
| Name | Description |
|---|---|
| TAsset |
Properties
Asset
Returns the referenced asset. This would usually require a load before being called.
Declaration
TAsset Asset { get; }
Property Value
| Type | Description |
|---|---|
| TAsset |
AssetKey
A key that can be used to reference the asset without loading it. Useful for loaders to determine which assets to load.
Declaration
string AssetKey { get; }
Property Value
| Type | Description |
|---|---|
| String |
HasAsset
Returns true if an asset is assigned as a reference.
Declaration
bool HasAsset { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsLoaded
Returns true if the referenced asset has been loaded.
Declaration
bool IsLoaded { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Methods
Instantiate(Transform)
Instantiates the referenced asset. This would usually require a load before being called.
Declaration
TAsset Instantiate(Transform parentTransform = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | parentTransform |
Returns
| Type | Description |
|---|---|
| TAsset |
LoadAssetAsync(Action<IAssetReference<TAsset>>)
Loads the referenced asset asynchronously and broadcasts a callback on completion.
Declaration
void LoadAssetAsync(Action<IAssetReference<TAsset>> onComplete)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<IAssetReference<TAsset>> | onComplete |
UnloadAsset()
Unloads the referenced asset.
Declaration
void UnloadAsset()