Playmaker Forum

PlayMaker Updates & Downloads => Official Action Updates => Topic started by: MrStanaland on May 24, 2014, 01:20:52 AM

Title: StartCoroutine and wait until finished
Post by: MrStanaland on May 24, 2014, 01:20:52 AM

To let my FSM's wait for a long running task, I've attached a modified version of the StartCoroutine action with a new boolean that let's you decide whether FINISH is called at the start or end of your coroutine.

The magic is a wrapper coroutine that yields until the underlying coroutine completes before calling the Finish function:

Code: [Select]
IEnumerator CoroutineWrapper() {
    yield return DoStartCoroutine();
    Finish();
}


Note: I didn't modify the OnExit, but StopCoroutine *might* need to be called on the wrapper when the waitForFinish is selected.