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>, Boolean)
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. |
Boolean | 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>(IList<Object>, Action<TObject>, Addressables.MergeMode)
Loads multiple assets identified by a list of keys.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<object> keys, Action<TObject> callback, Addressables.MergeMode mode)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | 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>(IEnumerable, Action<TObject>, Addressables.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>(IList<Object>, Action<TObject>, Addressables.MergeMode, Boolean)
Load multiple assets. Each key in the provided list will be translated into a list of locations. Those many lists will be combined down to one based on the provided MergeMode. See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<object> keys, Action<TObject> callback, Addressables.MergeMode mode, bool releaseDependenciesOnFailure)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | 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 |
Boolean | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored. When true, if any matching location fails, all loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed. When false, if any matching location fails, the returned .Result will be an IList of size equal to the number of locations attempted. Any failed location will correlate to a null in the IList, while successful loads will correlate to a TObject in the list. The .Status will still be Failed. When true, op does not need to be released if anything fails, when false, it must always be released. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the assets. |
LoadAssetsAsync<TObject>(IEnumerable, Action<TObject>, Addressables.MergeMode, Boolean)
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 |
Boolean | 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>(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>, Boolean)
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). |
Boolean | 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.