Search Unity

Addressable ReleaseInstance() delete the Instantiated() too

Discussion in 'Addressables' started by hazuhiro, Jan 20, 2020.

  1. hazuhiro

    hazuhiro

    Joined:
    Feb 14, 2019
    Posts:
    34
    Hi, i created an object using
    Addressables.InstantiateAsync(obj)
    then i duplicate that object using Instantiate()
    after that i click a button which have a function to release an addressable instance
    Addressables.ReleaseInstance(obj);
    the problem is the 2nd object that i duplicate using Instantiate() is destroyed too,
    how to prevent this?
    when i test in the computer (player) it doesnt destroyed the duplicated object,
    however when i use android phone it will destroy it
     
    Last edited: Jan 20, 2020
  2. JoeriCG

    JoeriCG

    Joined:
    Apr 25, 2018
    Posts:
    17
    I think in this case it's better to use Addressables.LoadAsync on the prefab, instantiate from that, and when you know all instances are destroyed, call Addressables.Release on the prefab.

    That or create all your objects with Addressables.InstantiateAsync, and copy whatever properties from the earlier instance you want copied after.
     
  3. hazuhiro

    hazuhiro

    Joined:
    Feb 14, 2019
    Posts:
    34
    thanks i already use that method, yeah agreed its better that way