What’s the best way to start a coroutine that has multiple arguments. For example:
// plays an animation and sends a message when done.
function PlayAnimWithCallback(aAnim, aObject, aCallback) {
if (!aAnim.isPlaying) {
aAnim.Play();
yield WaitForSeconds(aAnim.clip.length);
aObject.StartCoroutine(aCallback);
}
}
Using the following gives an error along the lines of: “no appropriate version of ‘…StartCoroutine’ for the argument list (System.String, System.Animation, System.Object, System.String) could be found.”
yield StartCoroutine("PlayAnimWithCallback", snakeStrikeAnim, gameControllerScript, "StrikeAnimDone");