Method LoadAssetsAsync
LoadAssetsAsync<TObject>(IList<IResourceLocation>, Action<TObject>)
Loads multiple assets, based on the list of locations provided.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<IResourceLocation> locations, Action<TObject> callback)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations of the assets. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
When you load Addressable assets, the system:
- Gathers the dependencies of the asset
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
If any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The Status
of the operation handle is set to Failed and the Result
is set to null.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.
LoadAssetsAsync<TObject>(IList<IResourceLocation>, Action<TObject>, bool)
Loads multiple assets, based on the list of locations provided.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<IResourceLocation> locations, Action<TObject> callback, bool releaseDependenciesOnFailure)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations of the assets. |
Action<TObject> | callback | Callback Action that is called per load operation. |
bool | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored.
When true, if any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The When false, if any matching location fails, the When |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
When you load Addressable assets, the system:
- Gathers the dependencies of the assets
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
If any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The Status
of the operation handle is set to Failed and the Result
is set to null.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.
LoadAssetsAsync<TObject>(IEnumerable, Action<TObject>, MergeMode)
Loads multiple assets identified by a list of keys.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IEnumerable keys, Action<TObject> callback, Addressables.MergeMode mode)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | keys | List of keys for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Addressables.MergeMode | mode | Method for merging the results of key matches. See Addressables.MergeMode for specifics |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
The keys in keys
are translated into lists of locations, which are merged into a single list based on
the value in mode
.
When you load Addressable assets, the system:
- Gathers the dependencies of the assets
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
If any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The Status
of the operation handle is set to Failed and the Result
is set to null.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.
LoadAssetsAsync<TObject>(string, Action<TObject>)
Loads multiple assets identified by a key.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(string key, Action<TObject> callback = null)
Parameters
Type | Name | Description |
---|---|---|
string | key | A key string to identify the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
The key in key
is translated into lists of locations, which are merged into a single list based on
the value in mode
.
When you load Addressable assets, the system:
- Gathers the dependencies of the assets
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
If any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The Status
of the operation handle is set to Failed and the Result
is set to null.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.
LoadAssetsAsync<TObject>(IEnumerable, Action<TObject>, MergeMode, bool)
Loads multiple assets, identified by a set of keys.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IEnumerable keys, Action<TObject> callback, Addressables.MergeMode mode, bool releaseDependenciesOnFailure)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | keys | IEnumerable set of keys for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Addressables.MergeMode | mode | Method for merging the results of key matches. See Addressables.MergeMode for specifics |
bool | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored. When true, if any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The When false, if any matching location fails, the When |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
The keys in keys
are translated into lists of locations, which are merged into a single list based on
the value in mode
.
When you load Addressable assets, the system:
- Gathers the dependencies of the assets
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
If any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The Status
of the operation handle is set to Failed and the Result
is set to null.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.
LoadAssetsAsync<TObject>(string, bool, Action<TObject>)
Loads multiple assets, identified by a key.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(string key, bool releaseDependenciesOnFailure, Action<TObject> callback = null)
Parameters
Type | Name | Description |
---|---|---|
string | key | Key used to gather the resource locations. |
bool | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored. When true, if any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The When false, if any matching location fails, the When |
Action<TObject> | callback | Callback Action that is called per load operation. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
The key in key
is translated into lists of locations, which are merged into a single list based on
the value in mode
.
When you load Addressable assets, the system:
- Gathers the dependencies of the assets
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
If any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The Status
of the operation handle is set to Failed and the Result
is set to null.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.
LoadAssetsAsync<TObject>(object, Action<TObject>)
Loads multiple assets identified by a single key.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(object key, Action<TObject> callback)
Parameters
Type | Name | Description |
---|---|---|
object | key | Key for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
The key in key
is translated into a list of locations that are then loaded.
When you load Addressable assets, the system:
- Gathers the dependencies of the assets
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
If any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The Status
of the operation handle is set to Failed and the Result
is set to null.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.
LoadAssetsAsync<TObject>(object, Action<TObject>, bool)
Loads multiple assets identified by a single key.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(object key, Action<TObject> callback, bool releaseDependenciesOnFailure)
Parameters
Type | Name | Description |
---|---|---|
object | key | Key for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation (per loaded asset). |
bool | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored. When true, if any assets cannot be loaded, the entire operation fails. The operation releases any assets and dependencies it had already loaded.
The When false, if any matching location fails, the When |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
Remarks
The key in key
is translated into a list of locations that are then loaded.
When you load Addressable assets, the system:
- Gathers the dependencies of the assets
- Downloads any remote AssetBundles needed to load the assets or their dependencies
- Loads the AssetBundles into memory
- Populates the
Result
object of the AsyncOperationHandle<TObject> instance returned by this function
Use the Result
object to access the loaded assets.
See the Loading Addressable Assets documentation for more details.
See Operations for information on handling the asynchronous operations used to load Addressable assets.