- Home /
*BCE0070 Error* Apparently my functions depend on each other
I'm not sure if this is a syntax error or what. But Unity is stating this: "Definition of 'Move.Left()' depends on 'Move.Right()' whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle." I appreciate any and all help. If more code is needed to answer the question, I will supply what is needed. Thankyou!
function Right()
{
if (rightEnabled){
transform.Translate(cowSpeed*Time.deltaTime, 0, 0);
yield WaitForSeconds(turnTime);
rightEnabled=false;
leftEnabled=true;
Left();
}
}
function Left()
{
if (leftEnabled){
print("Left");
transform.Translate(-cowSpeed*Time.deltaTime, 0, 0);
yield WaitForSeconds(turnTime);
leftEnabled=false;
rightEnabled=true;
Right();
}
}
Answer by Eric5h5 · Aug 08, 2012 at 11:36 PM
Since they are coroutines, the type of the functions is IEnumerator. However it would be better not to use recursion like this; use a loop instead.
In case it wasn't obvious, I am incredibly new to program$$anonymous$$g. Could you possibly show me rather than tell me? If not, I'll just go and look for some info.
No, it's definitely not C# at all. If it was C#, it would be
IEnumerator Right()
I always post answers using the same language that the question uses, unless otherwise specified.
Your answer