Can't Identify Culprit for Error
I'm getting an error message that the "type or namespace 'rockStates' can't be found' and that I might be missing a "using directive or an assembly reference". I'm writing this code based on a tutorial and it looks pretty much identical to the one in the video. There weren't any errors in that code, so I'm wondering what my mistake is. :/
using UnityEngine; using System.Collections;
public class RocksGO : MonoBehaviour {
public enum rockStates
{
idle,
highlighted,
exploding
}
public rocksStates currentRockState;
// Use this for initialization
void Start ()
{
currentRockState = rockStates.idle;
}
// Update is called once per frame
void Update ()
{
switch (currentRockState) {
case rockStates.highlighted:
Debug.Log ("Rock is highlighted.");
break;
case rockStates.exploding:
Debug.Log ("Rock exploded!");
break;
case rockStates.idle:
Debug.Log ("No rock selected.");
break;
}
}
}
Answer by appicarts · Sep 26, 2015 at 04:28 PM
@PTElephant you've misspelled the rockStates enum variable rocksStates , see that extra small s ...
Your answer
Follow this Question
Related Questions
SQLite Reader.read always returns false (Unity 5) 1 Answer
Cube rolling problem (rotation problem) 1 Answer
why doesnt change my money float? 2 Answers
Removing item from list makes it appear at the bottom ? 1 Answer
Trying to get Player to shoot in both directions depending on what side he is facing? 0 Answers