Hello all,
I’m relatively new to Unity & could use some help. I’ll try to be as specific & concise as possible…
I have a pathNode.js script that has the following:
enum PathInstruction{moveLeft=0, moveRight=1, moveStop=2, jumpAir=3}
var pathInstruction = PathInstruction.moveStop;
function OnTriggerEnter (other : Collider)
{
if(other.tag == "enemy")
{
print("Goomba's here");
}
}
On a separate enemyGumba.js, I am trying to call pathInstruction & assign it to my gumbaState with the following lines:
/*variables*/
enum GumbaState{moveLeft=0, moveRight=1, moveStop=2, jumpAir=3, enemyDie=4, goHome=5}
/*basic movements*/
var gumbaState = GumbaState.moveLeft;
:
:
function OnTriggerEnter (other : Collider)
{
/*when gumba collides with pathNode*/
if(other.tag == "pathNode")
{
print(gumbaState);
var linkToPathNode = other.GetComponent(pathNode);
gumbaState = linkToPathNode.pathInstruction;
}
}
but- I am getting the error: BCE0022: Cannot convert ‘PathInstruction’ to ‘GumbaState’.
What can I do to correct this, do I need to instantiate gumbaState in a Start function?
Thanks in advance,
scr33ner