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

    Class Addressables

    Entry point for Addressable API, this provides a simpler interface than using ResourceManager directly as it assumes string address type.

    Inheritance
    System.Object
    Addressables
    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.AddressableAssets
    Syntax
    public class Addressables

    Properties

    ResourceLocators

    Gets the list of configured IResourceLocator objects. Resource Locators are used to find 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.

    Methods

    Instantiate<TObject>(IResourceLocation, InstantiationParameters)

    Instantiate object.

    Declaration
    public static IAsyncOperation<TObject> Instantiate<TObject>(IResourceLocation location, InstantiationParameters instantiateParameters)where TObject : Object
    Parameters
    Type Name Description
    IResourceLocation location

    The location of the Object to instantiate.

    InstantiationParameters instantiateParameters

    Parameters for instantiation.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

    Instantiate<TObject>(IResourceLocation, Transform, Boolean)

    Instantiate single object.

    Declaration
    public static IAsyncOperation<TObject> Instantiate<TObject>(IResourceLocation location, Transform parent = null, bool instantiateInWorldSpace = false)where TObject : Object
    Parameters
    Type Name Description
    IResourceLocation location

    The location of the Object to instantiate.

    Transform parent

    Parent transform for instantiated object.

    System.Boolean instantiateInWorldSpace

    Option to retain world space when instantiated with a parent.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

    Instantiate<TObject>(IResourceLocation, Vector3, Quaternion, Transform)

    Instantiate single object.

    Declaration
    public static IAsyncOperation<TObject> Instantiate<TObject>(IResourceLocation location, Vector3 position, Quaternion rotation, Transform parent = null)where TObject : Object
    Parameters
    Type Name Description
    IResourceLocation location

    The location of the Object to instantiate.

    Vector3 position

    The position of the instantiated object.

    Quaternion rotation

    The rotation of the instantiated object.

    Transform parent

    Parent transform for instantiated object.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

    Instantiate<TObject>(Object, InstantiationParameters)

    Instantiate single object.

    Declaration
    public static IAsyncOperation<TObject> Instantiate<TObject>(object key, InstantiationParameters instantiateParameters)where TObject : Object
    Parameters
    Type Name Description
    System.Object key

    The key of the location of the Object to instantiate.

    InstantiationParameters instantiateParameters

    Parameters for instantiation.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

    Instantiate<TObject>(Object, Transform, Boolean)

    Instantiate single object.

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

    The key of the location of the Object to instantiate.

    Transform parent

    Parent transform for instantiated object.

    System.Boolean instantiateInWorldSpace

    Option to retain world space when instantiated with a parent.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

    Instantiate<TObject>(Object, Vector3, Quaternion, Transform)

    Instantiate single object.

    Declaration
    public static IAsyncOperation<TObject> Instantiate<TObject>(object key, Vector3 position, Quaternion rotation, Transform parent = null)where TObject : Object
    Parameters
    Type Name Description
    System.Object key

    The key of the location of the Object to instantiate.

    Vector3 position

    The position of the instantiated object.

    Quaternion rotation

    The rotation of the instantiated object.

    Transform parent

    Parent transform for instantiated object.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

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

    Instantiate multiple objects.

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

    The locations of the objects to instantiate.

    Action<IAsyncOperation<TObject>> callback

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

    InstantiationParameters instantiateParameters

    Parameters for instantiation.

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

    InstantiateAll<TObject>(Object, Action<IAsyncOperation<TObject>>, InstantiationParameters)

    Instantiate multiple objects.

    Declaration
    public static IAsyncOperation<IList<TObject>> InstantiateAll<TObject>(object key, Action<IAsyncOperation<TObject>> callback, InstantiationParameters instantiateParameters)where TObject : Object
    Parameters
    Type Name Description
    System.Object key

    The key of the location of the objects to instantiate.

    Action<IAsyncOperation<TObject>> callback

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

    InstantiationParameters instantiateParameters

    Parameters for instantiation.

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

    InstantiateAll<TObject>(Object, Action<IAsyncOperation<TObject>>, Transform, Boolean)

    Instantiate multiple objects.

    Declaration
    public static IAsyncOperation<IList<TObject>> InstantiateAll<TObject>(object key, Action<IAsyncOperation<TObject>> callback, Transform parent = null, bool instantiateInWorldSpace = false)where TObject : Object
    Parameters
    Type Name Description
    System.Object key

    The key of the locations of the objects to instantiate.

    Action<IAsyncOperation<TObject>> callback
    Transform parent

    Parent transform for instantiated objects.

    System.Boolean instantiateInWorldSpace

    Option to retain world space when instantiated with a parent.

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

    LoadAsset<TObject>(IResourceLocation)

    Load a single asset

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

    The location of the asset.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

    LoadAsset<TObject>(Object)

    Load a single asset

    Declaration
    public static IAsyncOperation<TObject> LoadAsset<TObject>(object key)where TObject : class
    Parameters
    Type Name Description
    System.Object key

    The key of the location of the asset.

    Returns
    Type Description
    IAsyncOperation<TObject>
    Type Parameters
    Name Description
    TObject

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

    Load multiple assets

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

    The locations of the assets.

    Action<IAsyncOperation<TObject>> callback
    Returns
    Type Description
    IAsyncOperation<System.Collections.Generic.IList<TObject>>
    Type Parameters
    Name Description
    TObject

    LoadAssets<TObject>(IList<Object>, Action<IAsyncOperation<TObject>>, Addressables.MergeMode)

    Load mutliple assets

    Declaration
    public static IAsyncOperation<IList<TObject>> LoadAssets<TObject>(IList<object> keys, Action<IAsyncOperation<TObject>> callback, Addressables.MergeMode mode = Addressables.MergeMode.None)where TObject : class
    Parameters
    Type Name Description
    System.Collections.Generic.IList<System.Object> keys

    List of keys for the locations.

    Action<IAsyncOperation<TObject>> callback

    Callback Action that is called per load operation.

    Addressables.MergeMode mode

    Merge method of locations.

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

    LoadAssets<TObject>(Object, Action<IAsyncOperation<TObject>>)

    Load mutliple assets

    Declaration
    public static IAsyncOperation<IList<TObject>> LoadAssets<TObject>(object key, Action<IAsyncOperation<TObject>> callback)where TObject : class
    Parameters
    Type Name Description
    System.Object key

    Key for the locations.

    Action<IAsyncOperation<TObject>> callback

    Callback Action that is called per load operation.

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

    LoadScene(IResourceLocation, LoadSceneMode)

    Load scene.

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

    The location of the scene to load.

    LoadSceneMode loadMode

    Scene load mode.

    Returns
    Type Description
    IAsyncOperation<Scene>

    LoadScene(Object, LoadSceneMode)

    Load scene.

    Declaration
    public static IAsyncOperation<Scene> LoadScene(object key, LoadSceneMode loadMode = null)
    Parameters
    Type Name Description
    System.Object key

    The key of the location of the scene to load.

    LoadSceneMode loadMode

    Scene load mode.

    Returns
    Type Description
    IAsyncOperation<Scene>

    PreloadDependencies(IList<Object>, Action<IAsyncOperation<Object>>, Addressables.MergeMode)

    Asynchronously loads only the dependencies for the specified list of keys.

    Declaration
    public static IAsyncOperation<IList<object>> PreloadDependencies(IList<object> keys, Action<IAsyncOperation<object>> callback, Addressables.MergeMode mode = Addressables.MergeMode.None)
    Parameters
    Type Name Description
    System.Collections.Generic.IList<System.Object> keys

    List of keys for which to load dependencies.

    Action<IAsyncOperation<System.Object>> callback

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

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

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

    PreloadDependencies(Object, Action<IAsyncOperation<Object>>)

    Asynchronously loads only the dependencies for the specified key.

    Declaration
    public static IAsyncOperation<IList<object>> PreloadDependencies(object key, Action<IAsyncOperation<object>> callback)
    Parameters
    Type Name Description
    System.Object 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.

    RecordInstanceSceneChange(GameObject, Scene, Scene)

    Notify the ResourceManager that a tracked instance has changed scenes so that it can be released properly when the scene is unloaded.

    Declaration
    public static void RecordInstanceSceneChange(GameObject gameObject, Scene previousScene, Scene currentScene)
    Parameters
    Type Name Description
    GameObject gameObject

    The gameobject that is being moved to a new scene.

    Scene previousScene

    Previous scene for gameobject.

    Scene currentScene

    Current scene for gameobject.

    ReleaseAsset<TObject>(TObject)

    Release asset.

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

    The asset to release.

    Type Parameters
    Name Description
    TObject

    ReleaseInstance(Object, Single)

    Release instantiated object.

    Declaration
    public static void ReleaseInstance(Object instance, float delay = 0F)
    Parameters
    Type Name Description
    Object instance

    The instantiated object to release.

    System.Single delay

    The time delay in seconds to wait until releasing the instantiated object. If this value is less than 0, it will release immediately.

    UnloadScene(Scene)

    Unload scene.

    Declaration
    public static IAsyncOperation<Scene> UnloadScene(Scene scene)
    Parameters
    Type Name Description
    Scene scene

    The scene to unload.

    Returns
    Type Description
    IAsyncOperation<Scene>
    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