Calling Unity Coroutines (IEnumerator) from a node

FlowCanvas Forums Support Calling Unity Coroutines (IEnumerator) from a node

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #2337


    I love your FlowCanvas because it allows me to connect a lot of my previous scripts with the amazing visual programming style.

    However I can only call functions, not Coroutines on Unity 2017.4.29. The code below doesn’t work when calling it from a Keyboard Key node:

    But if I transform the IEnumerators to void methods (and removing the yield statements) then everything is fine.

    How can I call scripted Coroutines with FlowCanvas?





    Thanks a lot for your positive feedback on FlowCanvas.

    Unfortunately (at least right now), IEnumerator methods are not automatically treated as Coroutines by FlowCanvas. There is however a way to invoke coroutines as you would normally do in code, meaning by using a “StartCoroutine” function node like for example:


    In the example above however, the Log “OK” node, will be executed in the same frame when the event is called, while the coroutine will continue “running” in the background, which I suppose is not exactly what you would ideally want.

    With that said, another more proper solution for running coroutines -for now- within a flowScript, would be to actually create custom “LatentAction” nodes, in case the functionality of what you want to do, is not shared with your own codebase as well, but rather only used within the scope of FlowCanvas. Creating a LatentAction node (which basically means a coroutine node), is quite easy as well. If you open up the file named “Time.cs”, you will find a couple of LatentActionNodes (like Wait, WaitUntil, WaitWhile etc) and see how they are implemented as a base for creating your own.

    Please let me know if the above works for you, or if of course you have any questions.

    Thanks again!

    Join us on Discord:

    You must be logged in to view attached files.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.