I’m trying to create a main menu and change from scene0 to scene 1, but for some reason, it is trying to load scene 2 and I get the following error message:
Scene with build index: 2 couldn’t be loaded because it has not been added to the build settings.
To add a scene to the build settings use the menu File->Build Settings…
UnityEngine.SceneManagement.SceneManager:LoadScene (int)
MainMenu:PlayGame () (at Assets/Scripts/MainMenu.cs:10)
UnityEngine.EventSystems.EventSystem:Update ()
I have two scenes in the build editor, 0 and 1 and I don’t know why it is trying to find a scene 2.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour
{
public void PlayGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}

