Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Start calls inconsistencies

Discussion in 'Addressables' started by Mic_Emond, Dec 15, 2021.

  1. Mic_Emond

    Mic_Emond

    Joined:
    Nov 16, 2016
    Posts:
    44
    We're using addressables (1.19.11) in addition to our own pool system.

    We use InstantiateAsync, and then right when we get the callback, we do a couple things with the result, mostly get some info, parent it to the pool parent and then disable the object with gameObject.setActive(false) (all in the same frame)

    We have started getting inconsistent calls to the "Start" method in monobehaviours. SOME objects will call Start(); Others won't.

    We were building our systems out of the expectation that if you Instantiate and disable in the same frame, only Awake() would be called. We can work with either, but ideally not with "sometimes yes, sometimes no".

    What is the expected behavior of this when using InstantiateAsync? Is this an addressable issue or a more general Unity issue?

    Anybody else encountered this? Any help greatly appreciated.

    Here is everything we do in the InstantiateAsync callback
    upload_2021-12-15_11-52-33.png

    upload_2021-12-15_11-50-52.png
     

    Attached Files:

  2. Mic_Emond

    Mic_Emond

    Joined:
    Nov 16, 2016
    Posts:
    44
    We still didn't find an answer to this, so if anybody has any insight, it would be greatly appreciated
     
  3. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    How are you reacting to Addressables completing the instantiation? This can change when you receive the information that it has been instantiated.

    Inevitably however, I do not think you should be using InstantaiteAsync from Addressables for you usage.
    Instead, call LoadAssetAsync for the Prefab, then instantiate it using the standard UnityEngine.Object.Instantiate call. This will give you full control.
     
  4. Mic_Emond

    Mic_Emond

    Joined:
    Nov 16, 2016
    Posts:
    44
    Thank you for your help. I think you are right, we should separate load from instantiate and then we'll have better control of timings.