# Scriptmultiplescenes

> How to edit multiple scenes with scripts, through the Editor or at runtime.

## Use scripts to edit multiple scenes

You can edit multiple scenes using scripts within the Editor or at runtime.

## Use scripts within the Editor

When using (or running) scripts within the Editor, use:

* [`Scene`](/engine/6000.3/script-reference/unityengine/scenemanagement/scene.md) struct: Available both in the Editor and at runtime, Scene struct contains read-only properties that relate to the scene itself, such as name and asset path.
* [`EditorSceneManager`](/engine/6000.3/script-reference/unityeditor/scenemanagement/editorscenemanager.md) API: This class is only available only in the Editor and has several functions to implement all the Multi-Scene editing features described in the pages [Setup multiple scenes](/engine/6000.3/manual/working-with-scenes/multi-scene-editing/setupmultiplescenes.md) and [Bake data in multiple scenes](/engine/6000.3/manual/working-with-scenes/multi-scene-editing/bakemultiplescenes.md).
* [`SceneSetup`](/engine/6000.3/script-reference/unityeditor/scenemanagement/scenesetup.md) utility class: A utility class that you can use to store information about a scene that is in the Hierarchy window.

## Use runtime scripts

When using scripts at runtime to edit multiple scenes, use the functions in the [`SceneManager`](/engine/6000.3/script-reference/unityengine/scenemanagement/scenemanager.md) class such as `LoadScene` and `UnloadScene`.

**Tips**:

* To instantiate a [prefab](/engine/6000.3/manual/working-with-gameobjects/prefabs.md) in a scene, use [`PrefabUtility.InstantiatePrefab`](/engine/6000.3/script-reference/unityeditor/prefabutility/instantiateprefab.md).
* To move objects to the root of a scene, use [`Undo.MoveGameObjectToScene`](/engine/6000.3/script-reference/unityeditor/undo/movegameobjecttoscene.md).
* To avoid having to setup your Hierarchy window every time you restart the Editor, or to store different setups, use [`EditorSceneManager.GetSceneManagerSetup`](/engine/6000.3/script-reference/unityeditor/scenemanagement/editorscenemanager/getscenemanagersetup.md), which also gets a list of SceneSetup objects that describes the current setup. You can serialize the objects into a `ScriptableObject` along with any other information you want to store about your scene setup. To restore your Hierarchy window, recreate the list of `SceneSetups` and use [`EditorSceneManager.RestoreSceneManagerSetup`](/engine/6000.3/script-reference/unityeditor/scenemanagement/editorscenemanager/restorescenemanagersetup.md).
* To get a list of your loaded scenes at runtime, get the `sceneCount` and iterate over the scenes with [`GetSceneAt`](/engine/6000.3/script-reference/unityengine/scenemanagement/scenemanager/getsceneat.md).
