2D Roguelike part 5 - Code or script issue "Are you missing 'Complete' using directive"
Hello I was wandering if someone could help as I'm stuck. I'm following the Roguelike tutorial and now I'm stuck using the GameManager script.
I get this error
"Assets/Scripts/GameManger.cs(10,10): error CS0246: The type or namespace name BoardManager2' could not be found. Are you missing
Completed' using directive?"
I'm not sure what it means as before it basically said I needed a bracket.
using UnityEngine;
using System.Collections;
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 BoardManager2 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()
{
}
}
Any help would be appreciated.
Regards,
Answer by alankemp · May 15, 2017 at 03:52 PM
It is telling you that it can't find a class called BoardManager2 in your project, so you cannot use it as a type.
Do you have a class called BoardManager2 somewhere? (Is the 2 on the end a typo?)
Hello , I have found a short term work around by hiding the namespace. I'm not entirely convinced that this is a fix but it seams to have moved things forward.
//namespace Completed
Your answer
Follow this Question
Related Questions
Scale of object does not update properly with public variable 1 Answer
Update and Get PlayerPrefs during runtime? 0 Answers
How can I make the game object follow the mouse? 1 Answer
Set One GameObject Inactive If Another GameObject Is Active? 1 Answer
Find active Child gameobject out of multiple gameobjects 2 Answers