using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class NextGame : MonoBehaviour
{
int allScene;
void Start()
{
allScene = SceneManager.sceneCountInBuildSettings;
}
void OnGUI()
{
if (GUILayout.Button("Next Scene",GUILayout.MinWidth(300),GUILayout.MinHeight(200)))
{
int currentScene=SceneManager.GetActiveScene().buildIndex;
if (currentScene <= allScene - 2)
{
SceneManager.LoadSceneAsync(currentScene + 1);
}
else
{
SceneManager.LoadSceneAsync(0);
}
}
}
}