Search Unity

[Bug] [1.1.4] GameObject loses material on scene reload in Build

Discussion in 'Addressables' started by unknowndevice, Jun 20, 2019.

  1. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
    I think this is a bug unless I'm doing something very silly. Present in the latest previous versions as well. Using Unity 2019.1.7f1

    1) Open Scene which loads a GameObject using InstantiateAsync. Everything loads fine.
    2) Change scenes.
    3) Return to previous scene
    4) GameObject loads using InstantiateAsync again. This time the GameObject is pink

    I've also tried calling Addressables.ReleaseInstance and Addressables.Release when the scene unloads just in case it would matter. My understanding is this is unnecessary since the scene unloading cleans the GameObjects up in the Addressables reference count. Nothing changed when I did this.

    This only happened in a build release and debug. I've never seen it happen in the editor.
     

    Attached Files:

    Last edited: Jun 20, 2019
    NickZhao likes this.
  2. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
  3. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
    I should mention this happens to all GameObject's with a SpriteRenderer Materal, not just the GameObjects loaded by Addressables. If I don't use Addressables to create GameObjects with SpriteRenderers then it doesn't happen anymore.
     
  4. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Almost certainly a bug. We've heard of similar issues, but haven't been able to track them down. This should send us in a good direction. If we need more info, I'll let you know.
     
  5. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
  6. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
    @unity_bill I don't really understand why but I reorganised the code this morning and it's no longer happening.