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

    Class ResourceManager

    Inheritance
    System.Object
    ResourceManager
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: UnityEngine.ResourceManagement
    Syntax
    public static class ResourceManager

    Properties

    InstanceProvider

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

    Declaration
    public static 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 static 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 static ISceneProvider SceneProvider { get; set; }
    Property Value
    Type Description
    ISceneProvider

    The scene provider.

    Methods

    GetResourceProvider<TObject>(IResourceLocation)

    Gets the appropriate IResourceProvider for the given location.

    Declaration
    public static 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)

    Declaration
    public static IAsyncOperation<IList<object>> LoadDependencies(IResourceLocation location)
    Parameters
    Type Name Description
    IResourceLocation location
    Returns
    Type Description
    IAsyncOperation<System.Collections.Generic.IList<System.Object>>

    ProvideInstance<TObject>(IResourceLocation, InstantiationParameters)

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

    Declaration
    public static IAsyncOperation<TObject> ProvideInstance<TObject>(IResourceLocation location, InstantiationParameters instantiateParameters)where TObject : Object
    Parameters
    Type Name Description
    IResourceLocation location
    InstantiationParameters instantiateParameters
    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)

    Asynchronouslly instantiate mullitple prefab (GameObject) at the specified key.

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

    locations of prefab asset

    Action<IAsyncOperation<TObject>> callback
    InstantiationParameters instantiateParameters
    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 static 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 keys.

    Declaration
    public static 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.

    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 key.

    Declaration
    public static IAsyncOperation<Scene> ProvideScene(IResourceLocation location, LoadSceneMode loadMode = null)
    Parameters
    Type Name Description
    IResourceLocation location
    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 static void ReleaseInstance(Object instance, IResourceLocation location)
    Parameters
    Type Name Description
    Object instance

    Instance to release.

    IResourceLocation location

    ReleaseResource<TObject>(TObject, IResourceLocation)

    Release resources belonging to the asset at the specified key.

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

    Object to release.

    IResourceLocation location
    Type Parameters
    Name Description
    TObject

    Object type.

    ReleaseScene(IResourceLocation, Scene)

    Asynchronously unloads the scene.

    Declaration
    public static IAsyncOperation<Scene> ReleaseScene(IResourceLocation location, Scene scene)
    Parameters
    Type Name Description
    IResourceLocation location
    Scene scene
    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