change scene 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 do you switch scenes unity

using UnityEngine.SceneManagement;

SceneManager.LoadScene('Scene');

Example 3: change scene unity

SceneManager.LoadScene("name of scene", LoadSceneMode.Single);

Example 4: load scene unity

using UnityEngine.SceneManagement


public class LoadScene : MonoBehavior
{
	public string sceneToLoad = "Level2";
    
    public void Start()
    {
    	SceneManager.LoadScene(sceneToLoad);
    }
}

Example 5: unity scene change

using UnityEngine.SceneManagement;

SceneManager.LoadScene("YourSceneName");

Example 6: change scene unity

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