Search Unity

Addressable is a child. Do I need to Addressables.ReleaseInstance it before destroying parent?

Discussion in 'Addressables' started by mailfromthewilds, Apr 22, 2020.

  1. mailfromthewilds

    mailfromthewilds

    Joined:
    Jan 31, 2020
    Posts:
    217
    1. Parent of addressable is not an addressable (but even if it was, i think it wouldnt change anything)
    2. addressable was created with addressables.InstantiateAsync

    So do I have to first Addressables.ReleaseInstance the child (which is addressable) and then Destroy() parent object (which is not addressable)?

    or will in this case just using Addressables.ReleaseInstance on parent work?(mind you I know Addressables.ReleaseInstance changes into Destroy when it should, but in this case what im asking for is how childs are treated)
     
  2. RyanJVR

    RyanJVR

    Joined:
    Jan 15, 2014
    Posts:
    9
    Bump.
    Also very interested to know the answer to this!
     
  3. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    586
    I believe the answer is yes, you need to call ReleaseInstance. The Destroy API has no way of notifying Addressables that it needs to decrement the reference. In fact, an Addressables dev actually recommended you replace all your Destroy calls with Addressables.ReleaseInstance so you won't have to worry about it.