Delay in a function

Hi, I’ve just started playing around with functions and I’m trying to convert a system I’ve built based around a retriggerable delay into a function.
However, I am unable to do so and get the following error message:
“Error Delay contains a latent call, which cannot exist outside of the event graph”

Is there a way around this? Or is the only solution to put everything the delay triggers into the function and leave the delay out of the function?

Thanks,
Teed

1 Like

A function is supposed to finish immediately (and may return a value), you can’t use delay in a function.

1 Like

Best way I can think around it (without seeing your function) would be to fire off everything in front of the delay in your function , then delay and call the other portion in another function, event, macro or something…

you might have to get a touch creative but anything is doable in blueprints so good luck…

Thanks for the replies!
Guess I’m going to be getting creative then…!

Use custom events (in Event Graph) instead of functions.

1 Like

Dude it’s been 8 years I think they got it by now

2 Likes

hey its for people like me who didn’t get it in 2014

3 Likes

I’ve found the best way is just to avoid latent actions (delay and such) altogether. and use timers and delegates.
it’s much more solid and maintainable (imho) in the long run, compared to async code.
specially with code that might be re-entrant.