Search Unity

Object is instantiated into a separate scene?

Discussion in 'Editor & General Support' started by MosquitoByte, Dec 15, 2019.

  1. MosquitoByte

    MosquitoByte

    Joined:
    Sep 17, 2018
    Posts:
    213
    I have a system set up where a Manager scene is always loaded in the background of any scene, to hold on to variables i want to pass between scenes. The manager scene contains an object named Manager, and manager contains an array of prefabs. The scene currently loaded instantiates those prefabs to use them as enemies. However, they dont show up in the scene, and i think i know why. In the hierarchy, it shows the instantiated object as being in the manager scene! Why is this, and how would i go about fixing it?
     
  2. MosquitoByte

    MosquitoByte

    Joined:
    Sep 17, 2018
    Posts:
    213
    Upon further inspection, it seems any object that gets instantiated is placed into the manager scene, even though the script doing the instantiating is not in that scene. I never set it to do this, so whats up?
     
  3. MosquitoByte

    MosquitoByte

    Joined:
    Sep 17, 2018
    Posts:
    213
    I ended up getting it to go where its supposed to by using SceneManager.setactivescene, but that is very inconvenient to do every time this scene is changed to. Would it be a problem if i just left it as is? Would there be any hidden consequences to leaving it in the manager scene as long as i destroy the objects once their usefulness is up?