Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

LoadSceneAsync not unloading all assets

Discussion in 'Addressables' started by Fishing_Cactus, Jul 29, 2020.

  1. Fishing_Cactus

    Fishing_Cactus

    Joined:
    Nov 8, 2014
    Posts:
    45
    Hello I am having issues with assets persisting over scenes while they should unload and was wondering if somebody here could help me out.
    I am currently on Unity 2019.3.11f1 and Addressables 1.12.0.

    If I continuosly switch between our main menu and ingame scenes we get an increase in live objects and we seem to not destroy the threads that were used to load our assetbundles. On platforms with low thread counts this makes the application crash after 2-3 times.

    Most of our assets are addressables and bundled in assetbundles but we are not loading those ourselves, we only load our scenes through addressables and they will then load the assets that are needed from the other bundles.

    If you look at the following screenshots (both are taken in the main menu, second is after we loaded into a gamescene and returned back to the main menu with LoadMode.Single from LoadSceneAsync) you can clearly see that almost everything increased in number and size while to my knowledge it should almost be the exact same.




    So then I want to the memory profiler to can a more indepth view and I noticed that we have quite some objects that have a refcount of 0 that are not unloaded, I only show a few here but there are a ton.

    I know assetbundles can partially load but not partially unload except if we call Resources.UnloadUnusedAssets, which I tried as well but it does not seem to have an impact at all.

    And if I look at the crashdump I see threads that are not being used anymore but that aren't destroyed which I speculate is because we failed midway while unloading assetbundles.


    I have been trying to reproduce this issue in a small sampleproject to no succes as of yet.

    TLDR: Our threads do not seem to be released because LoadSceneAsnc cannot correctly release all its related assets. Could someone give me a bit more insight on this?
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,796
  3. Fishing_Cactus

    Fishing_Cactus

    Joined:
    Nov 8, 2014
    Posts:
    45
    HI @TreyK-47

    It turns out it was not specifically linked to scene loading.

    Case: 1268994