Release/ReleaseInstance don't work well.

There are two problems that confuse me.

  1. In SceneLoading project, I set a custom material to spheres to check ref count in the profiler.When loading spheres,the ref count goes to 4,and there is no ref count after unloading the scene.But it don’t clear unused assets until I call Resources.UnloadUnusedAssets() in code manually.This obviously differ to the document which said “Once a given asset’s ref-count is at zero, it will be unloaded.”
    Here are the screenshots.


    Imgur: The magic of the Internet
    Imgur: The magic of the Internet

  2. In my own project ,When I initiate one prefab,which has been set a custom material,its ref count goes to 2,amazing me a lot. I tried Addressables.Release()/ReleaseInstance(),but they both decrease ref count by 1,there is still ref count of 1.
    Imgur: The magic of the Internet
    Imgur: The magic of the Internet
    Imgur: The magic of the Internet


  1. As noted in the docs, Memory management | Package Manager UI website, things won’t actually get unloaded from memory until the bundle they are in is unloaded. In our demo project, the default group is set to “pack together”. This means everything is in one bundle, and nothing will really ever get unloaded. If you do pack separately, it should work right. One problem is our profiler isn’t really displaying information in the most helpful way at the moment. We are looking into improving it, but would love some comments on What would you like the Profiler to show to help guide that.

  2. I’m not exactly sure what’s going on here. Perhaps you can file a ticket against unity with a repro project.

I solve the problem by change the Play Mode Scipt to"packed play mode", still thanks a lot.

1 Like