- Home /
Question by
Rikar Lionheart · Jun 24, 2015 at 07:06 PM ·
c#errortutorial
is expected error
I can't figure out what's wrong with the code; i've copied directly from the tutorial and it's giving me the error above. Can anyone give me a hand?
using UnityEngine;
using System.Collections;
namespace Completed
{
using System.Collections.Generic; //Allows us to use Lists.
public class GameManager : MonoBehaviour
{
public static GameManager instance = null; //Static instance of GameManager which allows it to be accessed by any other script.
private BoardManager boardScript; //Store a reference to our BoardManager which will set up the level.
private int level = 3; //Current level number, expressed in game as "Day 1".
//Awake is always called before any Start functions
void Awake()
{
//Check if instance already exists
if (instance == null)
//if not, set instance to this
instance = this;
//If instance already exists and it's not this:
else if (instance != this)
//Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
Destroy(gameObject);
//Sets this to not be destroyed when reloading scene
DontDestroyOnLoad(gameObject);
//Get a component reference to the attached BoardManager script
boardScript = GetComponent<BoardManager>();
//Call the InitGame function to initialize the first level
InitGame();
}
//Initializes the game for each level.
void InitGame()
{
//Call the SetupScene function of the BoardManager script, pass it current level number.
boardScript.SetupScene(level);
}
//Update is called every frame.
void Update()
{
}
}
Comment
Answer by Landern · Jun 24, 2015 at 07:07 PM
If this is literally the script text, then you're missing the ending curly brace that should exist on line 57 to close the namespace block.
If not, then you need to actually post the error that you're getting, otherwise it's guess work.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Following the wiki.unity scripting tutorial... 1 Answer
Distribute terrain in zones 3 Answers
Errors in adveture game tutorial 0 Answers
How to code in coins 1 Answer