I cant find how to load the next scene . i checked reference but not specific on code Help
on certain collisions I tried coding the new scene loading…
I was using loadlevel manager and was working but unity changed this and uses scene manager now
on collision my new scene wont load I have tried using the unity reference code but still not working obviously im doing something wrong but theres so little info on this specific topic since unity just changed it and theres no script answers at all. ive looked for days
nothing is out there but the older loadlevel script snippets
Here are some functions that I regularly use (in C#)
using UnityEngine.SceneManagement; // required for SceneManager
public void RestartGame()
{
SceneManager.LoadScene(0);
}
public void ReloadCurrentScene()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
public void LoadPreviouScene()
{
if (SceneManager.GetActiveScene().buildIndex > 0)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
}
else
{
SceneManager.LoadScene(0);
}
}
public void LoadNextScene()
{
if (SceneManager.GetActiveScene().buildIndex < (sceneCountInBuildSettings -1)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
else
{
ReloadCurrentScene();
}
}
if you need Unity script let me know. Also, very important, all scenes need to be added to the Scenes in Build list in the Build Settings screen for this to work (see image below). See Unity docs here - under Description.