Release instance on non-addressable game objects

I see the deprecation warning when trying to use Addressables.ReleaseInstance(gameObject); on the gameObject, that previously was not created with the Addressables. So, what will be the right way to do something like this or we always have to track by ourselfs which objects come from Addressables and which not?

We hadn’t locked that in when we wrote the warning, so we didn’t explain it there, but the plan is to return a success bool. So your code would be something like:

        if(!Addressables.ReleaseInstance(myGameObject))
            GameObject.Destroy(myGameObject);

Once this comes out, we’ll update the docs and note it in the changelog.

3 Likes

of note, once this returns the bool, it will no longer print a warning if it gets something it doesn’t recognize.

Thanks for clarification.