So I am having problems with a project. I am making a restart feature for my game. And it is giving me bullcrap errors that make no sense at all.
Can someone give me some alternatives? These are the errors:
3- Assets/GameManage.cs(21,10): error CS1547: Keyword `void' cannot be used in this context 4- Assets/GameManage.cs(21,22): error CS1525: Unexpected symbol `(', expecting `,', `;', or `=' 5-Assets/GameManage.cs(31,0): error CS1525: Unexpected symbol `}'
This is the code:
using UnityEngine.SceneManagement;
using UnityEngine;
public class GameManager : MonoBehaviour
{
bool GameHasEnded = false;
public float GameDelay = 1f;
public void EndGame()
{
if (GameHasEnded == false)
{
GameHasEnded = true;
Invoke("RestartingTheGame", GameDelay);
}
void RestartingTheGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
}
↧