docs.unity3d.com
    Show / Hide Table of Contents

    Method ProvideResources

    ProvideResources<TObject>(IList<IResourceLocation>, Action<TObject>)

    Asynchronously load all objects in the given collection of locations. If any matching location fails, all loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed.

    Declaration
    public AsyncOperationHandle<IList<TObject>> ProvideResources<TObject>(IList<IResourceLocation> locations, Action<TObject> callback = null)
    Parameters
    Type Name Description
    IList<IResourceLocation> locations

    locations to load.

    Action<TObject> callback

    This callback will be invoked once for each object that is loaded.

    Returns
    Type Description
    AsyncOperationHandle<IList<TObject>>

    An async operation that will complete when all individual async load operations are complete.

    Type Parameters
    Name Description
    TObject

    Object type to load.

    ProvideResources<TObject>(IList<IResourceLocation>, Boolean, Action<TObject>)

    Asynchronously load all objects in the given collection of locations.

    Declaration
    public AsyncOperationHandle<IList<TObject>> ProvideResources<TObject>(IList<IResourceLocation> locations, bool releaseDependenciesOnFailure, Action<TObject> callback = null)
    Parameters
    Type Name Description
    IList<IResourceLocation> locations

    locations to load.

    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.

    Action<TObject> callback

    This callback will be invoked once for each object that is loaded.

    Returns
    Type Description
    AsyncOperationHandle<IList<TObject>>

    An async operation that will complete when all individual async load operations are complete.

    Type Parameters
    Name Description
    TObject

    Object type to load.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023