Getting started with Addressable Assets | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Getting started with Addressable Assets

    Installing the Addressable Assets package

    Requires Unity 2018.2 or later.

    To install this package, follow the instructions in the Package Manager documentation.

    Marking Assets as addressable

    There two ways to mark an item as an Addressable Asset. Once the Addressable Assets package is installed, you can mark an Asset as addressable in the Inspector window or drag it into the Addressables window.

    In the Inspector window for the item, click the Address checkbox and enter a name to identify the Asset.

    Open the Addressables window by clicking Window > Addressable Assets.

    Drag the item from the Project window’s Asset Folder into the Addressables window’s Asset tab.

    When you first start using Addressable Assets, the system saves some edit-time and run-time data Assets for your Project in Assets/AddressableAssetsData which should be added to your version control check in..

    Loading or instantiating by address

    You can load or instantiate an Asset at run-time. Loading an Asset loads all dependencies into memory (including Asset bundle data if relevant). This allows you to use the Asset when you need to. Instantiating loads the Asset, and then immediately adds it to the scene.

    The default address for an Asset is the path of the Asset. You can change the address to any unique name.

    To access an Asset in script using a string address:

    Addressables.Load<GameObject>("AssetAddress");

    or

    Addressables.Instantiate<GameObject>("AssetAddress");

    Using the AssetReference Class

    The AssetReference class provides a mechanism to access Assets without the need to know string (or other) addresses.

    To access an Addressable Asset using the *AssetReference *class:

    1. Select an Asset.
    2. In the Inspector, click the Add Component button and then select the component type.
    3. Add a public AssetReference object in the component. For example:

      public AssetReference explosion;

    4. In the Inspector, set which Asset the object is linked to by either dragging an Asset from the Project window onto the entry or clicking the entry to choose from previously defined addressable Assets (shown below).


    Begin typing the AssetReference name for easy filtering.

    Loading an Addressable Asset by object reference

    To load an AssetReference, call one of the methods defined on it. For example:

    AssetRefMember.Load<GameObject>();

    or

    AssetRefMember.Instantiate<GameObject>(pos, rot);

    In This Article
    • Installing the Addressable Assets package
    • Marking Assets as addressable
      • Loading or instantiating by address
      • Using the AssetReference Class
    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