Getting Scene Names at Runtime/Creating Scenes at runtime

unity get loaded scenes
unity scenemanager
unity get active scene
unity create scene at runtime
unity scenes in build
unity get current scene build index
unity editor get current scene
load scene by name unity

I want to build a RTS Game in Unity version I want to have a dropdown menu to select the level i want to play. I dont want to hardcode it in so how do i get the scene names at runtime? This is neccessary to add new Levels ingame. Thats the next question then. How do i create new scenes and add them to build path at runtime to use them ingame? for example in an map editor?

I cant use the UnityEditor to go through all scenes with foreeach, because its a editor class and these dont get into the final build..


Retrieving the names of your scenes at runtime with Unity – Da , Retrieving the names of your scenes at runtime with Unity First of all, I needed the names of my scenes, and the only place I found them was inside the Editor Build Then, simply loop into the array and get the name of your scenes in "​Scene #" + i + " : " + scenes[i].path + " is enabled" &amp  void OnGUI() { // Return the current Active Scene in order to get the current Scene name. Scene scene = SceneManager.GetActiveScene(); // Check if the name of the current Active Scene is your first Scene.

As explained here on the Unity forums, SceneManager.GetSceneAt only works with currently active scenes.

For now, you need to use work-arounds to get all scenes in your build during run-time, using EditorBuildSettings.scenes. You are right, this is only available during editing, but you can simply make sure to cache them to a run-time asset or component before building.

Also note that the documentation example for EditorBuildSettings.scenes actually gives you a pretty powerful script to grab all scenes, including those that have not been added to the build settings (and even adds them to the build settings, using a single button click)! You can just use that to save all scene paths to a component or ScriptableObject which will then be available during run-time.

How can I get a list of all scenes in the build?, Length; s++) //get total number of scenes in build; {; if (allScenes[s]. Add a scene in the build at runtime is non-sense, because if you are at  SceneManager.GetActiveScene ().name. Getting a list of all scene names added to the SceneManager: var numScenes = SceneManager.sceneCount; List<string> sceneNames = new List<string>(numScenes); for (int i=0; i < numScenes; ++i) { sceneNames.Add(StageManager.GetSceneAt(i).name); } Creating new scene at runtime:

Old I know, but it matched my search, so I'm posting my solution. This seems to be possible at runtime now using SceneUtility.GetScenePathByBuildIndex

What I did:

var sceneNames = new List<string>();
var regex = new Regex(@"([^/]*/)*([\w\d\-]*)\.unity");
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
    var path = SceneUtility.GetScenePathByBuildIndex(i);
    var name = regex.Replace(path, "$2");

Regex Credit

Is it possible to create scenes at runtime with the Unity engine , My friend and I are working on a game and wish to create a game You wouldn't necessarily be creating scenes, but running the same scene with scripts that create I have a ways to go before I get to that point (still working on terrain new title, so I would have the scene name created like the following: ArcGIS Runtime SDK provides partial read support for the Esri web scene specification. This page describes support for web scenes and associates web scene features with classes. This release of ArcGIS Runtime does not support persistence (write, edit, save or upload) of web scenes. Scenes

Scripting API:, The returns a run-time, read-only, string value. The name limits to 244 Create a Project with two Scenes, scene1 and scene2 . 2. Attach the script​  The Unity 3d API for scene management is not perfect, it relies on names and paths at run-time yet provides no way to get information about the scenes that were added to the build settings. This project aims to alleviate that by automatically creating/updating an asset with this information when a build happens and also provides a easy way to ac…

Scripting API: SceneManagement.Scene.buildIndex, A Scene that is not added to the Scenes in Build window returns a buildIndex one more than the highest in the list. For example, if you don't add a Scene to a  I procedurally generate a scene with houndreds of game object at runtime. I need to somehow be able to save and reload the generated scene a later point to edit it. I am desperate for any help at this point. I have no idea how this can be done. I m also happy with any asset from the store that can do this. Any tips is appreciated. Thank you

How can I create scenes programmatically from a deployed build in , Create an empty new Scene at runtime with the given name. The new Scene will be opened additively into the hierarchy alongside any existing Scenes that are  How to Create a New Scene Your scenes are basically presets for what you want your lights to do and will be used to other features in the app such as routines, switches, and home & away. With the Philips Hue application you can create two types of scenes, Image and Lights.