Good ways to delay event one frame, two frames?

Hi Everyone,

I’d like to find a elegant way of delaying an event for the next frame to spread out some of the cpu load and minimize frame time hitches and there are a few places where I could just do something ‘the next frame/tick’ instead of immediately.

Does anyone have any elegant solutions for how to do this?
It would be used inside a ‘Custom Event’ and other places which are single shot runs only, (ie no every frame tick places).

Cheers,

IIRC a delay node with delay set to 0.0 will execute its output next frame.

6 Likes

Cool I just tested this and it seems you a right! Thanks a lot! :slight_smile:

I didn’t know the node worked like that and I couldn’t find any documentation on it when searching after you told me.
I tested it like this in regular PIE and VR PIE so should be at different tick rates and they both seem do what you suggested.

Hopefully it still works in more unusual circumstances like when you missed a frame due to say high GPU or CPU.

I’ll be more careful now leaving Delay nodes in but ‘temporarily’ setting them to zero to disable them. :slight_smile:

1 Like

I’ve learned something new today ^^
Nice hacky solution

I’m pretty sure you’re correct. In theory, you could probably delay two frames by putting two of them back to back, or three frames if you put three back to back, etc etc. I’ll test this in a bit to see if it works or not and let you know.

How about within a function? As you can’t use a delay node within a function

1 Like

Convert function to event and use DelayUntilNextTick instead of Delay0.0