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

    Class ResourceManager

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

    Fields

    m_postEvents

    Declaration
    public static bool m_postEvents
    Field Value
    Type Description
    System.Boolean

    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.

    resourceLocators

    Gets the list of configured IResourceLocator objects. Resource Locators are used to find IResourceLocation objects from user-defined typed keys.

    Declaration
    public static IList<IResourceLocator> resourceLocators { get; }
    Property Value
    Type Description
    System.Collections.Generic.IList<IResourceLocator>

    The resource locators list.

    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

    GetResourceLocation<TKey>(TKey)

    Resolve an key to an IResourceLocation

    Declaration
    public static IResourceLocation GetResourceLocation<TKey>(TKey key)
    Parameters
    Type Name Description
    TKey key

    key to resolve.

    Returns
    Type Description
    IResourceLocation

    The resource location.

    Type Parameters
    Name Description
    TKey

    The key type

    GetResourceProvider<TObject>(IResourceLocation)

    Gets the appropriate IResourceProvider for the given loc.

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

    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.

    InstantiateAllAsync<TObject, TKey>(IList<TKey>, Action<IAsyncOperation<TObject>>, Transform, Boolean)

    Instantiate all prefabs (GameObjects) in the given collection of keys.

    Declaration
    public static IAsyncOperation<IList<TObject>> InstantiateAllAsync<TObject, TKey>(IList<TKey> keys, Action<IAsyncOperation<TObject>> callback, Transform parent = null, bool instantiateInWorldSpace = false)where TObject : Object
    Parameters
    Type Name Description
    System.Collections.Generic.IList<TKey> keys

    Collection of keys to instantiate.

    Action<IAsyncOperation<TObject>> callback

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

    Transform parent
    System.Boolean instantiateInWorldSpace
    Returns
    Type Description
    IAsyncOperation<System.Collections.Generic.IList<TObject>>

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

    Type Parameters
    Name Description
    TObject

    Instantiated object type.

    TKey

    key type.

    InstantiateAsync<TObject, TKey>(TKey, Transform, Boolean)

    Declaration
    public static IAsyncOperation<TObject> InstantiateAsync<TObject, TKey>(TKey key, Transform parent = null, bool instantiateInWorldSpace = false)where TObject : Object
    Parameters
    Type Name Description
    TKey key
    Transform parent
    System.Boolean instantiateInWorldSpace
    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject
    TKey

    InstantiateAsync<TObject, TKey>(TKey, Vector3, Quaternion, Transform)

    Declaration
    public static IAsyncOperation<TObject> InstantiateAsync<TObject, TKey>(TKey key, Vector3 position, Quaternion rotation, Transform parent = null)where TObject : Object
    Parameters
    Type Name Description
    TKey key
    Vector3 position
    Quaternion rotation
    Transform parent
    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject
    TKey

    LoadAllAsync<TObject, TKey>(IList<TKey>, Action<IAsyncOperation<TObject>>)

    Asynchronously load all objects in the given collection of keys.

    Declaration
    public static IAsyncOperation<IList<TObject>> LoadAllAsync<TObject, TKey>(IList<TKey> keys, Action<IAsyncOperation<TObject>> callback)where TObject : class
    Parameters
    Type Name Description
    System.Collections.Generic.IList<TKey> keys

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

    TKey

    key type.

    LoadAsync<TObject>(IResourceLocation)

    Load the TObject at the specified location.

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

    LoadAsync<TObject, TKey>(TKey)

    Load the TObject at the specified key.

    Declaration
    public static IAsyncOperation<TObject> LoadAsync<TObject, TKey>(TKey key)where TObject : class
    Parameters
    Type Name Description
    TKey key

    key to load.

    Returns
    Type Description
    IAsyncOperation<TObject>

    An async operation.

    Type Parameters
    Name Description
    TObject

    Object type to load.

    TKey

    key type.

    LoadSceneAsync<TKey>(TKey, LoadSceneMode)

    Asynchronously loads the scene a the given key.

    Declaration
    public static IAsyncOperation<Scene> LoadSceneAsync<TKey>(TKey key, LoadSceneMode loadMode = null)
    Parameters
    Type Name Description
    TKey key

    key of the scene to load.

    LoadSceneMode loadMode

    Scene Load mode.

    Returns
    Type Description
    IAsyncOperation<Scene>

    Async operation for the scene.

    Type Parameters
    Name Description
    TKey

    key type.

    PreloadDependenciesAllAsync<TKey>(IList<TKey>, Action<IAsyncOperation<Object>>)

    Asynchronously loads only the dependencies for a collection of keys.

    Declaration
    public static IAsyncOperation<IList<object>> PreloadDependenciesAllAsync<TKey>(IList<TKey> keys, Action<IAsyncOperation<object>> callback)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<TKey> keys

    Collection of keys for which to load dependencies.

    Action<IAsyncOperation<System.Object>> callback

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

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

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

    Type Parameters
    Name Description
    TKey

    key type.

    PreloadDependenciesAsync<TKey>(TKey, Action<IAsyncOperation<Object>>)

    Asynchronously loads only the dependencies for the specified key.

    Declaration
    public static IAsyncOperation<IList<object>> PreloadDependenciesAsync<TKey>(TKey key, Action<IAsyncOperation<object>> callback)
    Parameters
    Type Name Description
    TKey key

    key for which to load dependencies.

    Action<IAsyncOperation<System.Object>> callback

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

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

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

    Type Parameters
    Name Description
    TKey

    key type.

    QueueInitializationOperation(IAsyncOperation)

    Queues a resource locator load operation. While there are unfinished load operatiosn for resource locations, all provide load operations will be defered until the queue is empty.

    Declaration
    public static void QueueInitializationOperation(IAsyncOperation op)
    Parameters
    Type Name Description
    IAsyncOperation op

    An IAsyncOperation that loads an IResourceLocator

    Release<TObject>(TObject)

    Release resources belonging to the obj at the specified key.

    Declaration
    public static void Release<TObject>(TObject obj)where TObject : class
    Parameters
    Type Name Description
    TObject obj

    Object to release.

    Type Parameters
    Name Description
    TObject

    Object type.

    ReleaseInstance<TObject>(TObject)

    Releases resources belonging to the prefab instance.

    Declaration
    public static void ReleaseInstance<TObject>(TObject inst)where TObject : Object
    Parameters
    Type Name Description
    TObject inst

    Instance to release.

    Type Parameters
    Name Description
    TObject

    Instantiated object type.

    UnloadSceneAsync<TKey>(TKey)

    Asynchronously unloads the scene.

    Declaration
    public static IAsyncOperation<Scene> UnloadSceneAsync<TKey>(TKey key)
    Parameters
    Type Name Description
    TKey key

    key of the scene to unload.

    Returns
    Type Description
    IAsyncOperation<Scene>

    Async operation for the scene unload.

    Type Parameters
    Name Description
    TKey

    key type.

    Events

    initializationComplete

    Event that can be used to determine when the initialization operations have completed

    Declaration
    public static event Action initializationComplete
    Event Type
    Type Description
    Action

    The event.

    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