Answers for "load scene unity by name"

C#
26

unity load scene

using UnityEngine.SceneManagement;

//Put this in whenever you want to load a scene
SceneManager.LoadScene("Scene name");
Posted by: Guest on March-23-2020
13

unity load scene

using UnityEngine.SceneManagement;

int buildIndex = 0;
//Load the scene with a build index
SceneManager.LoadScene(buildIndex);
Posted by: Guest on April-18-2020
4

load scene unity

using UnityEngine.SceneManagement


public class LoadScene : MonoBehavior
{
	public string sceneToLoad = "Level2";
    
    public void Start()
    {
    	SceneManager.LoadScene(sceneToLoad);
    }
}
Posted by: Guest on June-22-2020
0

unity get scene name by index

private static string NameFromIndex(int BuildIndex)
 {
     string path = SceneUtility.GetScenePathByBuildIndex(BuildIndex);
     int slash = path.LastIndexOf('/');
     string name = path.Substring(slash + 1);
     int dot = name.LastIndexOf('.');
     return name.Substring(0, dot);
 }
Posted by: Guest on November-20-2020

C# Answers by Framework

Browse Popular Code Answers by Language