So I’m trying to thread together coroutines from multiple scripts, which has gone pretty well until hitting a step in which I may need to call StopCoroutine. According to Unity:
“Please note that only StartCoroutine using a string method name can be stopped using StopCoroutine.”
Which works fine for me within a single script, e.g. “yield return StartCoroutine(“CoMoveChar”, moveEnemy);”
My question is… how the hell do I call a string method name from another script? I’ve tried:
yield return StartCoroutine("scriptLoc.CoMoveChar", moveBlock);
and
yield return StartCoroutine(scriptLoc("CoMoveChar", moveBlock));
and
yield return StartCoroutine(scriptLoc.("CoMoveChar", moveBlock));
But it doesn’t work, or for that matter, even look right. Nor does pre-defining it as a string. Please halp!
The error Unity gives me always looks a bit like this:
Coroutine ‘StaticVars.selectedChar.GetComponent().CoMoveChar()’ couldn’t be started!