I’m trying to access an enum from another script but I keep getting the “Unknown Identifier” error.
Here’s how part of the script(CharacterControl) containing the enum looks like :
enum CharacterAnim {
Idle = 0,
Running = 1,
RunningBack = 2,
Sprinting = 3
}
var characterState : CharacterAnim;
function Update(){
if(Input.GetAxis("Vertical")==0 Input.GetAxis("Horizontal")==0){
characterState = CharacterAnim.Idle;
}
Here’s how part of the script that accesses the enum looks like :
function Awake () {
controllerScript = this.transform.GetComponent(CharacterControl);
}
if(controllerScript.characterState == CharacterAnim.Idle){
animation.CrossFade("soldierIdle");
}
I get the error : BCE0005: Unknown identifier: ‘CharacterAnim’.
Does anyone know what could be the problem?