Search Unity

Instantiating Objects in Additive Scenes

Discussion in 'Editor & General Support' started by Ekzalphantoss, Sep 5, 2019.

  1. Ekzalphantoss

    Ekzalphantoss

    Joined:
    Sep 27, 2016
    Posts:
    10
    When loading an additive scene if you instantiate objects at any of the following times: Awake, Start, OnEnable; then those objects are instantiated in the previous scene rather than the new scene. You cannot set the new scene as active until all the "Start" methods have passed.

    I have found similar topics in the forums but they all end in people using workarounds and Unity not really solving the issue. Btw I'm using 2018.4.4f1 LTS but I found that people have asked about this since 2012

    Not being able to switch the active scene after all objects have called their "Awake" is tolerable but not being able to do it until they have all called their "Start" method is too much. It means developers have to either artificially postpone every one of their scripts by 1 frame (including monobehaviours that don't have a default functionality such as "LateStart" or something like that) or they have to create some main parent object in the scene in advance and use "Find" (which we all know is expensive + you need a unique name for each object you want to use "Find" on) in order to have the objects instantiated in the correct scene.

    TL;DR : I'm reporting to Unity that it's about time they allowed additive scenes to be set as active before the objects from the new scene call their "Start" method
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,580
    You're not reporting anything by posting on these forums. Send a bug report.
     
    Joe-Censored likes this.
  3. angelababyhxm

    angelababyhxm

    Joined:
    Jul 25, 2019
    Posts:
    1
    still want to know the answer
     
unityunity