Playmaker Forum

PlayMaker Updates & Downloads => Official Action Updates => Topic started by: MrStanaland on May 23, 2014, 10:20:52 PM

Title: StartCoroutine and wait until finished
Post by: MrStanaland on May 23, 2014, 10:20:52 PM

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();

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