Class ResourceManager | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class ResourceManager

    Entry point for ResourceManager API

    Inheritance
    System.Object
    ResourceManager
    Namespace: UnityEngine.ResourceManagement
    Syntax
    public class ResourceManager : IDisposable

    Constructors

    ResourceManager()

    Declaration
    public ResourceManager()

    Properties

    ExceptionHandler

    Global exception handler. This will be called whenever an IAsyncOperation.OperationException is set to a non-null value.

    Declaration
    public static Action<IAsyncOperation, Exception> ExceptionHandler { get; set; }
    Property Value
    Type Description
    System.Action<IAsyncOperation, System.Exception>

    InstanceProvider

    Gets or sets the IInstanceProvider. The instance provider handles instatiating and releasing prefabs.

    Declaration
    public IInstanceProvider InstanceProvider { get; set; }
    Property Value
    Type Description
    IInstanceProvider

    The instance provider.

    ResourceProviders

    Gets the list of configured IResourceProvider objects. Resource Providers handle load and release operations for IResourceLocation objects.

    Declaration
    public IList<IResourceProvider> ResourceProviders { get; }
    Property Value
    Type Description
    System.Collections.Generic.IList<IResourceProvider>

    The resource providers list.

    SceneProvider

    Gets or sets the ISceneProvider. The scene provider handles load and release operations for scenes.

    Declaration
    public ISceneProvider SceneProvider { get; set; }
    Property Value
    Type Description
    ISceneProvider

    The scene provider.

    Methods

    Dispose()

    Disposes internal resources used by the resource manager

    Declaration
    public void Dispose()

    GetResourceProvider<TObject>(IResourceLocation)

    Gets the appropriate IResourceProvider for the given location.

    Declaration
    public IResourceProvider GetResourceProvider<TObject>(IResourceLocation location)
        where TObject : class
    Parameters
    Type Name Description
    IResourceLocation location

    The resource location.

    Returns
    Type Description
    IResourceProvider

    The resource provider.

    Type Parameters
    Name Description
    TObject

    The desired object type to be loaded from the provider.

    LoadDependencies(IResourceLocation)

    Asynchronously dependencies of a location.

    Declaration
    public IAsyncOperation<IList<object>> LoadDependencies(IResourceLocation location)
    Parameters
    Type Name Description
    IResourceLocation location

    location to load dependencies for.

    Returns
    Type Description
    IAsyncOperation<System.Collections.Generic.IList<System.Object>>

    Async operation for the dependency loads.

    ProvideInstance<TObject>(IResourceLocation, InstantiationParameters)

    Asynchronouslly instantiate a prefab (GameObject) at the specified location.

    Declaration
    public IAsyncOperation<TObject> ProvideInstance<TObject>(IResourceLocation location, InstantiationParameters instantiateParameters)
    Parameters
    Type Name Description
    IResourceLocation location

    location of the prefab.

    InstantiationParameters instantiateParameters

    A struct containing the parameters to pass the the Instantiation call.

    Returns
    Type Description
    IAsyncOperation<TObject>

    Async operation that will complete when the prefab is instantiated.

    Type Parameters
    Name Description
    TObject

    Instantiated object type.

    ProvideInstances<TObject>(IList<IResourceLocation>, Action<IAsyncOperation<TObject>>, InstantiationParameters)

    Asynchronously instantiate multiple prefabs (GameObjects) at the specified locations.

    Declaration
    public IAsyncOperation<IList<TObject>> ProvideInstances<TObject>(IList<IResourceLocation> locations, Action<IAsyncOperation<TObject>> callback, InstantiationParameters instantiateParameters)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<IResourceLocation> locations

    locations of prefab asset

    System.Action<IAsyncOperation<TObject>> callback

    This is called for each instantiated object.

    InstantiationParameters instantiateParameters

    A struct containing the parameters to pass the the Instantiation call.

    Returns
    Type Description
    IAsyncOperation<System.Collections.Generic.IList<TObject>>

    Async operation that will complete when the prefab is instantiated.

    Type Parameters
    Name Description
    TObject

    Instantiated object type.

    ProvideResource<TObject>(IResourceLocation)

    Load the TObject at the specified location.

    Declaration
    public IAsyncOperation<TObject> ProvideResource<TObject>(IResourceLocation location)
        where TObject : class
    Parameters
    Type Name Description
    IResourceLocation location

    Location to load.

    Returns
    Type Description
    IAsyncOperation<TObject>

    An async operation.

    Type Parameters
    Name Description
    TObject

    Object type to load.

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

    Asynchronously load all objects in the given collection of locations.

    Declaration
    public IAsyncOperation<IList<TObject>> ProvideResources<TObject>(IList<IResourceLocation> locations, Action<IAsyncOperation<TObject>> callback)
        where TObject : class
    Parameters
    Type Name Description
    System.Collections.Generic.IList<IResourceLocation> locations

    locations to load.

    System.Action<IAsyncOperation<TObject>> callback

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

    Returns
    Type Description
    IAsyncOperation<System.Collections.Generic.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.

    ProvideScene(IResourceLocation, LoadSceneMode)

    Asynchronously loads the scene a the given location.

    Declaration
    public IAsyncOperation<Scene> ProvideScene(IResourceLocation location, LoadSceneMode loadMode = null)
    Parameters
    Type Name Description
    IResourceLocation location

    location of the scene to load.

    LoadSceneMode loadMode

    Scene Load mode.

    Returns
    Type Description
    IAsyncOperation<Scene>

    Async operation for the scene.

    ReleaseInstance(Object, IResourceLocation)

    Releases resources belonging to the prefab instance.

    Declaration
    public void ReleaseInstance(object instance, IResourceLocation location)
    Parameters
    Type Name Description
    System.Object instance

    Instance to release.

    IResourceLocation location

    The location of the instance.

    ReleaseResource<TObject>(TObject, IResourceLocation)

    Release resources belonging to the asset at the specified location.

    Declaration
    public void ReleaseResource<TObject>(TObject asset, IResourceLocation location)
        where TObject : class
    Parameters
    Type Name Description
    TObject asset

    Object to release.

    IResourceLocation location

    The location of the resource to release.

    Type Parameters
    Name Description
    TObject

    Object type.

    ReleaseScene(Scene, IResourceLocation)

    Asynchronously unloads the scene.

    Declaration
    public IAsyncOperation<Scene> ReleaseScene(Scene scene, IResourceLocation location)
    Parameters
    Type Name Description
    Scene scene

    The scene to unload.

    IResourceLocation location

    key of the scene to unload.

    Returns
    Type Description
    IAsyncOperation<Scene>

    Async operation for the scene unload.

    Back to top
    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