Assets/Scripts/GameManager.cs(10,20): error CS0501: `GameManager.completeLevelUI()’ must h

Updated on July 17, 2017 in [A] Tutorials
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on July 15, 2017

Please help struggling for about an hour

 

Script:

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 GameOver ()
{
if (gameHasEnded == false)
{
gameHasEnded = true;
Debug.Log (“GAME OVER”);
Invoke(“Restart”, restartDelay);
}

}

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

}

 

Error:

Assets/Scripts/GameManager.cs(10,20): error CS0501: `GameManager.completeLevelUI()’ must have a body because it is not marked abstract, extern, or partial

 

 

 

  • Liked by
Reply
0 on July 17, 2017
public GameObject completeLevelUI ();

To this:

public GameObject completeLevelUI;

  • Liked by
Reply
Cancel