Search Unity

[bug] addressables save utility object ("ResourceManagerCallbacks") in scene and it leaks after that

Discussion in 'Addressables' started by nik_d, Aug 16, 2019.

  1. nik_d

    nik_d

    Joined:
    Apr 27, 2018
    Posts:
    48
    Addressables don't even try to reuse already created ResourceManagerCallbacks and artists don't notice them, so it became there are a lot of them in scenes.

    Even worse - if this object is saved in scene, because of DontDestroyOnLoad in MonoBehaviourCallbackHooks, they leak!

    workaround: in Runtime\ResourceManager\ResourceManager.cs
    after line:

    m_CallbackHooks = new GameObject("ResourceManagerCallbacks", typeof(MonoBehaviourCallbackHooks)).GetComponent<MonoBehaviourCallbackHooks>();

    put:

    m_CallbackHooks.hideFlags = HideFlags.DontSave | HideFlags.NotEditable; //**addressables: we don't need the utility object to be saved in scene //todo: cleanup current scenes
     
    GrandBOOM likes this.
  2. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    913
    thanks, we'll look into it.
     
  3. GrandBOOM

    GrandBOOM

    Joined:
    Oct 25, 2016
    Posts:
    5

    Thanks just what I needed. Maybe its hidden in a DLL or something (should not be because addresables are supposed to be open source) but I noticed the Dispose method in ResourceManager.cs has 0 usages.