Create new GameObject() in none active Scene

Hi everyone,

I’d like to create a GameObject in a none active scene. Would that be possible?

It’s not a good idea to get all Scenes by var Scenes = SceneManager.GetAllScenes(); and set the required scene to active. But this takes very long to activate a scene, switch back and the side effects are unknown.

Is there perhaps any other solution for?

I recommend setting some sort of flag, and when some manager object in the new scene wakes up, it checks for that flag and instantiates the object.

And creating a master scene that controls or creates all the other scenes without using GetAllScenes?

I forgot to say, it should be all based in editor mode. Perhaps the question “move a gameobject between different scenes without change the active scene” would be more exact.

The reason is simple. I have a main-scene and from this main scene script, I want to build different scens that are loaded in the hierarchy. Procedurally generated scenes in editor.

var go = new GameObject() works in the active scene only.

Maybe you want this?

1 Like

Args… Thank you! :slight_smile: