Error CS1513: } expected


Joined
Apr 4, 2022
Messages
1
Reaction score
0
Hi, I'm new to coding and came across this error when testing a game I am making,
Here is the code, error is on lines 33,6.

using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{


bool gameHasEnded = false;

public float restartDelay = 1f;
public GameObject CompleteLevelUI;

public void CompleteLevel()
{
CompleteLevelUI.SetActive(true);

}
public void EndGame()
{
if (gameHasEnded == false)
{

gameHasEnded = true;
Debug.Log("GAME OVER");
Invoke("Restart", restartDelay);
}

}

void Restart()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
 
Ad

Advertisements

Joined
Mar 3, 2021
Messages
243
Reaction score
29
That's tricky. There's nothing obviously wrong. Try adding public or private to the Restart() function, maybe? Are you able to upload the entire project or anything to test with?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top