xxxxxxxxxx
using UnityEngine.SceneManagement;
int buildIndex = 0;
//Load the scene with a build index
SceneManager.LoadScene(buildIndex);
xxxxxxxxxx
using UnityEngine.SceneManagement;
//Put this in whenever you want to load a scene
SceneManager.LoadScene("Scene name");
xxxxxxxxxx
using UnityEngine.SceneManagement
public class LoadScene : MonoBehavior
{
public string sceneToLoad = "Level2";
public void Start()
{
SceneManager.LoadScene(sceneToLoad);
}
}
xxxxxxxxxx
using UnityEngine;
using UnityEngine.SceneManagement;
public class YourSceneLoader : MonoBehaviour
{
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}
xxxxxxxxxx
SceneManager.LoadScene("SceneName", LoadSceneMode.Additive); //Loading the new scene
SceneManager.UnloadSceneAsync(val); // Unloading current scene
xxxxxxxxxx
// Assuming the user wants to load a new scene using a button click event
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneLoader : MonoBehaviour
{
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}
xxxxxxxxxx
using UnityEngine.SceneManagement;
void Start()
{
SceneManager.LoadScene(/*the Scene number*/);
}