How to Pause and Resume coroutine flow?

cooloon 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 1

In Unity C#, it's possible to pause and resume coroutines by doing like this: https://gist.github.com/cooloon/961dafae9055109ad9ac5371c7e2b15e

Now I wonder if I could do this without coding, but seems to be impossible. One idea is a flow graph like this: 

But this still require coding (implementation of RoutineImpl unit). Coroutine flow? See this: 

This does not "Resume" coroutine but "Restart" on enable. Is there any way to resume coroutine flow in Bolt?

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Satisfaction mark by cooloon 3 years ago

Hi cooloon, 

Sorry for the very late reply on this, I must have missed your thread.

Unfortunately there is no way to do exactly that at the moment, because Bolt doesn't expose the coroutine object as a value port. It's something I could consider in the future, but it would require quite a bit of design work.

You can try using a boolean variable inside your coroutine at the moment, that determines whether or not it will continue.