unity scene change code example
Example 1: how to switch scenes unity
SceneManager.LoadScene("MyScene");
Example 2: change scene unity
SceneManager.LoadScene("name of scene", LoadSceneMode.Single);
Example 3: load scene unity
using UnityEngine.SceneManagement
public class LoadScene : MonoBehavior
{
public string sceneToLoad = "Level2";
public void Start()
{
SceneManager.LoadScene(sceneToLoad);
}
}
Example 4: unity scene change
using UnityEngine.SceneManagement;
SceneManager.LoadScene("YourSceneName");
Example 5: change scene unity
SceneManager.LoadScene (sceneBuildIndex:/*Put the number here*/);