As per documentation Resources.UnloadUnusedAssets
should unload released assets even if other assets from the same bundle are still in use, but that's not the case.
- Build addressables
- Build standalone player (I've been testing on Windows) with development build enabled
- Open memory profiler and connect to the running player
- Take snapshot and notice "LargeTexture" held by
SpriteRenderer
andasyncHandle
, as expected - Focus the player window and press Space key to load "SmallTexture" and assign it to renderer
- Take snapshot and notice "LargeTexture" is now held only by
asyncHandle
, as expected - Focus the player window and press Space key to release "LargeTexture" and invoke
Resources.UnloadUnusedAssets
- Take memory snapshot again
- Expected: "LargeTexture" has to be unloaded
- Actual: "LargeTexture" is still loaded, while being held only by "AssetBundle"
Video: https://www.youtube.com/watch?v=tX8vrgie5N8
Issue tracker case number: IN-40196
.
Associated forum thread: https://forum.unity.com/threads/resources-unloadunusedassets-cannot-unload-assets-without-any-references.1088116/