Change scenes unity code example

Example 1: unity load scene

using UnityEngine.SceneManagement;

int buildIndex = 0;
//Load the scene with a build index
SceneManager.LoadScene(buildIndex);

Example 2: how to switch scenes unity

SceneManager.LoadScene("MyScene");

Example 3: how do you switch scenes unity

using UnityEngine.SceneManagement;

SceneManager.LoadScene('Scene');

Example 4: 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 5: change scene unity

SceneManager.LoadScene (sceneBuildIndex:/*Put the number here*/);

Example 6: loadscene unity

using UnityEngine;
using UnityEngine.SceneManagement;

public class Singleplayer : MonoBehaviour
{
    public void LoadNextLevel()
    {
    	//This will load the next scene in the buildIndex, e.g if in scene 3, go to scene 4
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex +1);
    }
}