For Each Loop With Delay

As per the title, I’m trying to build a simple “For Each Loop With Delay” BP macro, since it would be useful in many places.

However, it keeps on going into infinite loop and I can’t figure out why.

Here’s the current design, based on the original “For Each Loop”: For Each With Delay posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Any ideas?

Hello, the macro itself looks good for me. From the fact that your Delay requires World Context Object I assume that you do this in Object MacroLibrary or a Macro inside an UObject. I don’t think delays will work in UObjects.

Maybe try to do such macro in Actor MacroLibrary (and UserWidget MacroLibrary if you need it for widgets as well). Then it should work fine.

Okay, thank you…

This implementation is for UMG, it’s in a Blueprint Macro Library with UMG.Widget as parent. Any workarounds you can think of?

Ok but all Blueprint widgets inherits from UserWidget anyway. Maybe try to make this Macro Library for UserWidgets instead of Widgets?

EDIT: I’ve done the same macro for some projects, I will send it in about 20 minutes when I’m back home.

I can’t reparent to UserWidget. But UMG.WidgetComponent seems to work. → Correction. Needed to copy-paste the function to a new library.

So with UserWidgets as parent the ‘World Context Object’ is no longer required as you said:

…but the finite loop still occurs unchanged.

This is mine, without that initial delay parameter, you could try if it works in your case. It works for me as expected.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.