Why won't the For Each Loop work inside my Function Library
So, I've been having a problem using built-in macros (e.g. For-Each loops, Compare Int, etc.) in function libraries. When I was running 4.5, this (some selection sort code):
wouldn't compile because of the For-Each loop, the For loop, and the CompareInt functions*. I have since updated to 4.7, and now the only problem is in the For-Each. The error it gives me is this:
When I have it jump to the error node, this is what comes up:
Every part of the macro involving arrays (including the "inputs" section) gives the same error. What's the problem and how do I fix it?
*Interestingly enough, even when I was running 4.5, I had another function library in which I used the CompareInt function, and it worked fine in that one. I have no idea why it would work in one but not another.
Also, as a side note, does anyone know if they have added support for using time based events in function blueprints yet or if it's still confined to the level blueprint? Because that'd be useful.
edit: The variable I'm connecting to the For-Each loop is a structure. That shouldn't matter, though, should it?
They dont work because functions fire off as a single executed node, so certain functionality where it would need to do multiple executions just don't work, its why delays aren't supported in a function if Im remembering correctly. It will fire off the first loop body execution but not cycle through the rest. Maybe if you made a custom for each loop that will manually fire off the next index and you just loop the execution through it might work?
answered Feb 23 '19 at 06:10 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here