I want the variable DC to increase by one every time EndGame is called, but, every time I die, It logs one instead of increasing each time.
bool gameHasEnded = false;
public float restartDelay = 1f;
int DC;
public void EndGame ()
{
DC = DC + 1;
Debug.Log(DC);
if (gameHasEnded == false)
{
gameHasEnded = true;
Invoke("Restart", restartDelay);
}
}
void Restart ()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}