switch scene unity code example

Example 1: how to switch scenes unity

SceneManager.LoadScene("MyScene");

Example 2: how do you switch scenes unity

using UnityEngine.SceneManagement;

SceneManager.LoadScene('Scene');

Example 3: how to switch scenes in unity

using System.Collections; 
using System.Collections.Generic; 
using UnityEngine; 
using UnityEngine.SceneManagement;

//Load based on name of scene
public class SceneScript {
  public void ChangeScene(string scene = "") {
    SceneManager.LoadScene(sceneName:"scenes Name");
  }
}

Example 4: scene switch unity

SceneManager.LoadScene("SCENE_HERE");

// be sure to import UnityEngine.SceneManagement