2D Toolkit Forum
2D Toolkit => Support => Topic started by: GigaTron on August 23, 2013, 04:03:58 am
-
Hey guys I finally got 2DToolkit, but when adding the score Implementing but I got an error:
Assets/Scripts/ScoreScript.cs(36,38): error CS0103: The name `mole' does not exist in the current context
I'm new to programming so I'm not sure what to do. My mole object is called "Mole" and I changed it to that but I got the same error.
-
Maybe you forgot something like this
...
public Mole mole;
...
And drop mole object into this variable in the editor?
-
I just got another error:
Assets/Scripts/ScoreScript.cs(8,16): error CS0246: The type or namespace name `Mole' could not be found. Are you missing a using directive or an assembly reference?
Which game object would I attach it to? The tutorial doesn't say which object to attach it to.
-
Did you put this line (or a one similar to it)...
ScoreScript.Score += mole.Whacked ? 0 : 10;
in the ScoreScript? If so, that's why it's not working, it needs to go in the MainGameScript at the point where you detect a successful mole hit.