I am using SceneManager.GetActiveScene() in Unity 2019.1.0f2 Personal and I cannot use SceneManager.GetActiveScene() within a SceneManager.load.
The code is this:
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
bool gameHasEnded = false;
public void EndGame()
{
if (gameHasEnded == false)
{
gameHasEnded = true;
Debug.Log("GAME OVER");
Restart();
}
}
void Restart ()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}