So now that delays are killed off in the standard library in 4.7, how would one best approach this? I really just want the same functionality, a while loop with a delay that I can call easily.
Is my best bet to just create that as a function inside the delay-loop-needed blueprint? Seems hacky.
Not sure while loops are what you want. A tick might be more appropriate. Put a gate or something in there andaybe use delta seconds to time your delay.
You can also create a custom macro of how a loop works and put a delay into it, or even add an extra input to allow you to set a delay from the outside of the macro.
Oh I’m going to unashamedly steal that idea! Great, thanks.
So delays aren’t allowed in the standard macro library anymore in 4.7 hence me asking. With this solution it doesn’t seem to be a problem to be honest.
Actually it’s still possible to have a loop with a delay inside, you just have to bypass the editor checks by putting the delay in a collapsed graph and than pasting this into the macro.
Rudy Triplett from Epic came up with this workaround, since I asked about it on the answerhub. Just scroll down and you see Rudy’s solution
Using the Loop with delay creates a semblance of asynchrony?
And there is a similarity “StartCoroutine” in Unity to create async operation?
Or just Loop with delay?
I highly suggest using Timers for this, as it’s what they’re meant for.
(1) create a custom event or function with a given name (MyLoopBody) that executes the action you want to perform in a loop
(2) Set Timer. Flag “looping”, name the function to call (MyLoopBody), and set the time to whatever you want your interval to be.
Done.
Remember, UE tries to execute all of the operations of a loop inside a SINGLE Tick/execution command. Loops are for things where you need to repeat a logic across an arbitrary number of actors/instances of something (i.e. Applying Damage to all actors overlapped by an explosion, placing a spline mesh every 200 units of distance along a spline, whatever) as if it were a single logic call. They’re not actually for LOOPING (as in repeating over time) behaviors.
Wow, looking at how many nodes go into a single basic loop makes me think Epic should have added script along with Blueprints o.O It’s just so much simpler (to me at least) and more efficient to script using code vs Blueprint noodles mess (sorry, I still can’t wrap my head around Blueprints). I know there is C++ code, but afaik C++ should be really only used for underlying gameplay framework.
You sure you tried with and without “context sensitive” checked?
Try making your system on the eventGraph without using macro and then select all the nodes, right click, collapse to macro, and see if it works.
Also, you can copy/cut and paste nodes ( Ctrl-C/Ctrl-X, Ctrl-V ), so if you can insert a delay node outside of the macro, just cut, paste it into your macro.
hey , thanks for reply
context sensitive is off . yes its working when i use collapse to macro , also copy paste isnt working on standard macros , could you tell me why i cant add delay node in standard macros ?