Search Issue Tracker
By Design
Votes
59
Found in
2022.3.1f1
2023.1.0b18
2023.2.0a16
Issue ID
UUM-37775
Regression
No
The released assets are not unloaded when Resources.UnloadUnusedAssets is called
Reproduction steps:
1. Open the attached “ASDQWE” project
2. Open the Addressables Groups Window (Asset Management > Addresables > Groups)
3. Select Build > New Build > Default Build Scripts
4. Open the Build Settings Window (File > Build Settings)
5. Check “Development Build” and “Autoconnect Profiler”
6. Press the “Build And Run” button
7. Open the Memory Profiler Window (Window > Analysis > Memory Profiler)
8. Inside the Player Window, press the “Space” button on your keyboard twice
9. Inside the Memory Profiler Window, press the “Capture” button and select the new Capture
10. Select the “Unity Objects” tab
11. In the Description, select Texture2D > TextureLarge
12. Observe the References tab
Expected result: "LargeTexture" is unloaded
Actual result: "LargeTexture" is still loaded, while being held only by "AssetBundle"
Reproducible with: 2022.3.1f1, 2023.1.0b18, 2023.2.0a16
Could not test with: 2020.3.48f1 (error CS8124: Tuple must contain at least two elements), 2021.3.26f1 (Required Memory Profiler features are not available)
Reproducible on: Intel MacOS 13.3.1
-
Elringus
Aug 28, 2023 12:34
Related Unity forum thread with more context, repro project on GitHub and video demo of the issue: https://forum.unity.com/threads/resources-unloadunusedassets-cannot-unload-assets-without-any-references.1088116/#post-8991523
-
Anatsol
Aug 16, 2023 16:17
Voted on this, the first time I've ever needed to really needed to weigh in on bugs. Really wish it would get more attention. There's no real serviceable work around, so I hope this gets resolved soon!
-
DarkJune
Aug 07, 2023 11:54
Addressable assets is often used to create "modifiable" games, but issues like this may reduce reliability of the whole project and make it impossible for certain peoples with a lack of RAM to participate in highly modded playthrough at all.
Generally, modding is drastically increasing game lifetime and earnings, so fixing this issue is essential for all such games, whether is Visual Novel everyone is talking about, Grand level / RT strategies, FPS games, or an other game of an genre.
-
robotortoise
Aug 06, 2023 22:51
This is a super important issue for visual novels, so I would appreciate you guys taking a look! Naninovel in particular relies on this feature, and that's what our game uses :(
-
DeiLight
Aug 06, 2023 01:31
More granular unloading of individual assets from bundles is very important in specific genres of games like visual novels to optimize memory management. It would be greatly appreciated if more resources could be directed to exploring the possibility of more granular memory management for bundles in the Addressable Asset system.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android] [Particle System] "ParticleSystem.GeometryJob" sometimes takes up to ~20 ms in the worker thread when initializing 5 Particle Systems
- Can't change OpenXR settings when switching Build Profiles
- L(a,b) expression in float fields has erratic behaviour when ordering due to using instanceID as an index
- InvalidOperationException is thrown when switching to a custom Debug Draw Mode in Scene View
- [Android][Vulkan] Skybox and Environment effects flicker in the Player when using the Vulkan Graphics API
Resolution Note:
Hey! I’m sorry the documentation is misleading on this. Resources.UnloadUnusedAssets is a tricky one, as it shouldn’t be officially supported in Addressables because of complexity with object tracking between systems. It does ‘just about’ work with certain asset types, but many other types (including textures) cannot be unloaded in this way. This mistake in the documentation is not something we were aware of, and we will be fixing that.
The addressables loading system was originally designed to simplify loading of assets inside asset bundles, and automatically unload them when possible. The Addressables.Release API allows you to tell the system when an asset will no longer be used, and the system can automatically clean it up when all other assets loaded from that bundle are also released. Unfortunately this cannot unload assets where other assets from the same bundle are still in use, because Asset Bundles do not allow this. The workaround here is to lay out the asset bundles in a way that allows this, weighing up which assets are most commonly used together and the potential overhead of additional asset bundles.
I understand this outcome is disappointing, and believe me, we are taking this feedback into account for future work for loading runtime content. But as this particular API is not supposed to work as such, we will close this bug as 'By Design' and fix the documentation. Please take further details of your usecase to our Roadmap so that we can prioritize this effectively: https://unity.com/roadmap/unity-platform/pipeline-integrations