- Home /
error CS0246: type/namespace name `GameDate' couldn't be found.
Hi all, I'm following this book called "learning c# by developing games with unity", I've searched many sites for the answers but there were no luck. The full error is: "error CS0246: The type or namespace name `GameDate' could not be found. Are you missing a using directive or an assembly reference?" I problem is the code that I've 'written', I literally copied and pasted the code.
using UnityEngine;
using System.Collections;
public class EnergyPulsePower : MonoBehaviour
{
public float pulseDuration = 1f;
public Transform goodOrb;
void Update()
{
pulseDuration -= Time.deltaTime;
if(pulseDuration <= 0)
Destroy(gameObject);
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "BadOrb")
{
Instantiate(goodOrb, other.transform.position, other.transform.rotation);
GameObject.Find("GameManager").
GetComponent<GameDate>().playerLives += 1;
Destroy(other.gameObject);
Destroy(gameObject);
}
else
Destroy(gameObject);
}
}
Any response is appreciated.
Comment
Answer by Kazhium · May 10, 2014 at 02:21 PM
I found the problem, first of all on line 23, the author wrote:
GameObject.Find("GameManager).
And forgot to put the end quote on the 'Gamemanager'. Also on line 24, the author wrote:
GetComponent<GameDate>().playerLives += 1;
when it's supposed to be 'GameData'. Hope Others benefits from this too.