Make a video game series

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

I started programming like 2 days ago… please help

I put in the script and the error so please read both

 

Script:

using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour {

bool gameHasEnded = false;

public void GameOver ()
{
if (gameHasEnded == false)
{
gameHasEnded = true;
Debug.Log (“GAME OVER”);
Restart ();
}

}

void Restart ();
{
SceneManager.LoadSceneMode(SceneManager.)
}

}

Error:

Assets/GameManager.cs(21,2): error CS9010: Primary constructor body is not allowed

  • Liked by
Reply
2 on July 15, 2017

What?

You can’t just do this:

void Restart ();
{}

You don’t put a semicolon after the method declaration.

Also what’s this:

SceneManager.LoadSceneMode(SceneManager.)

You need to put something after the dot. This is unfinished code.

on July 15, 2017

Oh thanks, like I said started like 2 days ago

 

Devoted
on July 15, 2017

Maybe it would be better, if you just started learning, to not jump straight into Unity but first learn C# by itself.

Show more replies
  • Liked by
Reply
Cancel