Search Unity

Release/ReleaseInstance don't work well.

Discussion in 'Addressables' started by wy123455151, Aug 1, 2019.

  1. wy123455151

    wy123455151

    Joined:
    Feb 13, 2019
    Posts:
    6
    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.


    https://imgur.com/NkiNOGI
    https://imgur.com/2enTmdt

    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.
    https://imgur.com/1ClmKvF
    https://imgur.com/75wg71p
    https://imgur.com/1I5fAWf


     
    Last edited: Aug 1, 2019
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    1. As noted in the docs, https://docs.unity3d.com/Packages/com.unity.addressables@1.1/manual/MemoryManagement.html, 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 https://forum.unity.com/threads/what-would-you-like-the-profiler-to-show.712085/ 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.
     
  3. wy123455151

    wy123455151

    Joined:
    Feb 13, 2019
    Posts:
    6


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