Now that Custom Function Nodes can’t be called multiple times, what is the best way to avoid having Flow lines going backwards? We have a custom node we call Hold For Each which iterates over a collection but only triggers the next element when an input flow is called, now we have to drag multiple lines across the flow instead of calling a Custom Function that we usually name “Next” that is connected to that input in the Hold For Each node.
Hmm. Custom Functions preventation from being called multiple times, is added as a safe measure that ‘should’ only prevent the function to be re-called ONLY in the case that the function has not finished yet (Return Node Called).
Thus, if the CustomFunction’s Return node is called before calling the same function again, there should be no problem and the function should be called correctly. Can you please post a screenshot of how you “used” to do it before?
Hi! See attached image. The reason why we use this pattern is because there is no guarantee in our flow that a Do will finish on the same frame and we don’t want the next element in the collection to be evaluated before we are sure we are done evaluating the Current.
I see that you are using the Custom Function, basically as a ‘GOTO’ statement, which is interested, but can also be problematic with the current Custom Function implementation. I could certainly add a ‘GOTO’ like node, that will be best suited for this use case and I think that would be a good idea as well 🙂
Until the ‘GOTO’ nodes are added though, if you want, you can change the behaviour of Custom Function to the way it used to be in the previous version and as such allow you to invoke it even before a ‘Return’ node is called. To make the change, please open up CustomFunctionEvent.cs and in the ‘InvokeAsync’ method, simply delete the first 3 lines where the ‘isInvoking’ is checked.
If you have trouble finding, or making the change, please let me know.
Thanks for the follow up Rami.
A GOTO node will be added in the next version. Since the next version (v3.0) might take a while (planned for Christmas), if you want I can make the GOTO nodes sooner and send them out for you.