docs.unity.cn
    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 Copyright © 2021 Unity Technologies
    Generated by DocFX
    on Thursday, December 2, 2021
    Terms of use