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:
/*
Path node helper
Description: help control the logic of the enemy as it moves in the world
*/
enum PathInstruction{moveLeft=0, moveRight=1, moveStop=2, jumpAir=3}
var pathInstruction = PathInstruction.moveStop;
function OnTriggerEnter (other : Collider)
{
if(other.tag == "enemy")
{
print("default case from pathNode.js: " + pathInstruction);
/*this is functional*/
}
}
On a separate enemyGumba.js, I am trying to call pathInstruction assign it to my gumbaState with the following lines:
/*Global variables*/
enum GumbaState{moveLeft=0, moveRight=1, moveStop=2, jumpAir=3, enemyDie=4, goHome=5}
/*basic movements*/
var gumbaState = GumbaState.moveLeft;
/*sets the default state in the inspector*/
:
/*end global variables*/
function OnTriggerEnter (other : Collider)
{
/*when gumba collides with pathNode*/
if(other.tag == "pathNode")
{
print("instruction from enemyGumba.js: " + gumbaState);
var linkToPathNode = other.GetComponent(pathNode).pathInstruction;
print("assign property: " + other.GetComponent(pathNode).pathInstruction + " to variable getPathNodeInstruction = " + linkToPathNode);
print("getPathNodeInstruction is now: " + linkToPathNode);
print("now change the current gumbaState:" + gumbaState + " to " + linkToPathNode);
/*
var tempVar = getPathNodeInstruction;
print(tempVar);
*/
//gumbaState = linkToPathNode;
}
}
As expected, everything works fine:

Until I uncomment: gumbaState = linkToPathNode;
I get this error:
Assets/2D Mario Assets/Scripts/enemyGumba.js(172,30): BCE0022: Cannot convert 'PathInstruction' to 'GumbaState'.
I was hoping someone can help me figure this out…this is from the WalkerBoyStudio tutorial. I know they’re using an older version of Unity for the tutorials I’ve no idea if this is an issue with newer versions; having the ability to assign a property from an array to another…I don’t think that’s the case, but I don’t know where to start with this
All help/comment is greatly appreciated,
scr33ner