Lection 38. Button Click Loads Scene.
Hello. Can you help me?
When I click the button, next scene doesn’t load.
The program compiles correctly.
My code:
Code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneLoader : MonoBehaviour
{
public void LoadNextScene()
{
int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(currentSceneIndex + 1);
}
}