Search Unity

Question Troubles when trying to unload an addressable group

Discussion in 'Addressables' started by laymard, Jun 7, 2023.

  1. laymard

    laymard

    Joined:
    Jun 6, 2023
    Posts:
    3
    Hello,

    [Context information:
    • Unity version : 2020.3.29f1.1603
    • Addressables version : 1.21.12
    ]

    We are having issue in our project to unload an addressable group. We read the documentation, and it says that assets are unload only if all addressable from a group are removed.

    We released bunch of addressable at the end of the level in game, and yet we still have our addressable group assets in memory.

    We inspected the memory with the MemoryProfiler, and we saw that some objects (which seems to be loaded addressable assets which should have been released) are referenced by their child object.

    My questions are :
    • How can we inspect the memory to check which addressable have not been released yet ? And how can we check that from each group ? (that could be done with a tool or a debug command which prints in the log)
    • If an object is referenced only by one of its child object, does that prevent its garbage collection ? And such, does that prevent that asset to be completely removed from the memory
    Thank you !
     
    vchedeville likes this.
  2. laymard

    laymard

    Joined:
    Jun 6, 2023
    Posts:
    3
    Adding some informations

    My loaded game object have 1 reference, as all other prefab from my addressable group. And still, it does not want to unload from memory
     
  3. unity_shane

    unity_shane

    Unity Technologies

    Joined:
    Jun 3, 2021
    Posts:
    106
    @laymard,

    Hi there, first I'd recommend you check out the memory management in addressables docs article.

    This is very close to correct, but there is one small caveat - an asset is only unloaded once every asset in its assetbundle along with all of that assetbundle's dependencies are unloaded. This means that if dependencies of your asset are still loaded, those will also need to be unloaded before the asset will be unloaded. To better understand the dependencies between your assetbundles and to better understand what needs to be unloaded at runtime to clear up dependencies, I recommend you check out both the addressables report tool and the addressables profiler integration.
     
  4. laymard

    laymard

    Joined:
    Jun 6, 2023
    Posts:
    3
    Hello, thanks for the answer !

    I'm gonna try to use the Addressables Report Tool, but we are on 2020 LTS I hope it's gonna work well.

    About your comment :
    It means that if Asset A depends on Asset B, I have to explicitely call in code the release of Addressable B then Addressable A in order to unload A ?

    Thank you !