Search Unity

Resolved Fews questions about addressable

Discussion in 'Addressables' started by rangolee302, Jun 30, 2022.

  1. rangolee302

    rangolee302

    Joined:
    Feb 1, 2018
    Posts:
    22
    hi everyone! I got confused about Addressable when using it to implement a "module" feature to my project. Tell me if I am wrong while I try to explain my situation here.

    Background
    I try to make part of the game a "module" to players. The way I do it is to make that part a separated scene and mark it addressable. And player and download it from remote. The main goal is to reduce the size of build and keep each "module" separate from the main game.

    Question
    1. Will unity cache the data of addressable for me or it just download it every time I start the game? I found the size of a fresh window standalone build the same as the one I opened before. I thought it will store a cache of the addressable and make the size larger.
    2. Is addressable profile related to every build? Do I have to rebuild again when I switch from A profile to B profile? and how does it work in Editor.
    3. Can I check where is the addressable remote (like an url) at runtime?
     
  2. rangolee302

    rangolee302

    Joined:
    Feb 1, 2018
    Posts:
    22
    After a few test and google search, here is what I found

    1. addressable will cache with default setting, it can be clear though with API Caching.Clear or in group setting
    2. any change in the asset will require a new build in case you are not intend to update the catalog. In editor, it means that you do have to build again if you make changes.
    3. use
    Code (CSharp):
    1.  
    2. Addressables.InternalIdTransformFunc += location =>
    3. {
    4.     if (location.InternalId.StartsWith("http://") && location.InternalId.EndsWith(".json"))
    5.     {
    6.         //Do something with remote catalog location.
    7.     }
    8.     Debug.Log("location.InternalId  " + location.InternalId);
    9.  
    10.     return location.InternalId;
    11. };
    12.