Addressables.ReleaseInstance is not deleting object

I have discovered that Addressables.ReleaseInstance(go) is not destroying instances that are not actually addressables.

We have been told that it is supposed to catch the non addressables and call Destroy() on them but it doesn’t seem to be working.

Is this a known bug?

Hey @Jribs I imagine the result of your ReleaseInstance call is false, meaning it wasn’t able to release the object you passed in. In the past we would destroy GameObjects for you if they weren’t Addressable but I think that led to some awkward states and other various issues (I don’t have any details on those issues atm) so we ended up removing that.

If you have a mix of Addressable instantiated GameObjects and regular instantiated GameObjects and you could be releasing objects from either pool and you’re not sure which, I’d suggest something like

if(!Addressables.ReleaseInstance(myObject))
     Destroy(myObject);

or something to that effect.

1 Like

@davidla_unity great thanks that is good to know.

There are various sources around here that tell us to just replace every Destroy(myObject) with ReleaseInstance(myObject). If that is no longer true, that should probably be updated in the docs or something.

Yes, very good point. That does need to be updated in the docs. I appreciate you pointing that out.

What about ref count maintained by addressables in this case ?

1 Like