docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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 Status of the operation handle is set to Failed and the Result is set to null.

    When false, if any matching location fails, the Result instance in the returned operation handle contains an IList of size equal to the number of locations that the operation attempted to load. The entry in the result list corresponding to a location that failed to load is null. The entries for locations that successfully loaded are set to a valid TObject. The Status of the operation handle is still Failed if any single asset failed to load.

    When releaseDependenciesOnFailure is true, you do not need to release the AsyncOperationHandle instance on failure. When false, you must always release it.

    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 Status of the operation handle is set to Failed and the Result is set to null.

    When false, if any matching location fails, the Result instance in the returned operation handle contains an IList of size equal to the number of locations that the operation attempted to load. The entry in the result list corresponding to a location that failed to load is null. The entries for locations that successfully loaded are set to a valid TObject. The Status of the operation handle is still Failed if any single asset failed to load.

    When releaseDependenciesOnFailure is true, you do not need to release the AsyncOperationHandle instance on failure. When false, you must always release it.

    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 Status of the operation handle is set to Failed and the Result is set to null.

    When false, if any matching location fails, the Result instance in the returned operation handle contains an IList of size equal to the number of locations that the operation attempted to load. The entry in the result list corresponding to a location that failed to load is null. The entries for locations that successfully loaded are set to a valid TObject. The Status of the operation handle is still Failed if any single asset failed to load.

    When releaseDependenciesOnFailure is true, you do not need to release the AsyncOperationHandle instance on failure. When false, you must always release it.

    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

    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 Status of the operation handle is set to Failed and the Result is set to null.

    When false, if any matching location fails, the Result instance in the returned operation handle contains an IList of size equal to the number of locations that the operation attempted to load. The entry in the result list corresponding to a location that failed to load is null. The entries for locations that successfully loaded are set to a valid TObject. The Status of the operation handle is still Failed if any single asset failed to load.

    When releaseDependenciesOnFailure is true, you do not need to release the AsyncOperationHandle instance on failure. When false, you must always release it.

    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.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)