Is there any way to get a delay in a function

is there any way to get some sort of a delay in a function dosent matter how just need a delay i dont care how complicated it is but i need it real bad

I recommend you to create a macro if you need to have a delay, their is no way (from my experience) to get delay node inside function.

4 Likes

how does a macro help me?

Unless I’m misunderstanding your question, there is an actual “Delay” node.

Functions are executed in a synchronous manner and everything waits until the function returns its output. Their purpose is to return a result in exactly one frame. If you don’t have any outputs from the function (and why would you purposely wait N time to get an output?) feel free to swap it for a Custom Event where you can use latent stuff.

2 Likes

take a look on this → Macros | Unreal Engine Documentation

But as neelix32 say, you can push your function inside a custom event.

He want delay node inside function.

yes but with a custom event i cant get an output from a node

i can push it inside a function but i cant get an output from it

you can always store the intermediate result in a variable instead of using an output from a function

yeah but i need an exection output not a var

that wont help me because i need delay inside a funtion i cant split it into 2

Oh, just split it into two functions with a delay in between. Question is too vague to say more than that, OP is asking how to do something that can’t be done, that when phrased another way might have a solution for what he’s trying to do, but there’s no info to answer in that manner.

You can’t have a delay in a function. Maybe post a new question with what you’re actually trying to achieve and you’ll get help that does help you. :slight_smile:

Actually this is a good answer.

Please take a look on this → Macros | Unreal Engine Documentation

You’ll find exactly how to have input and output with macro. You have a LOT of image that explain exactly how it work.

i know how to use macros but they cant have the 3 nodes that i need i need to cast to a widget and a macro cant do that

i know i can cast but i cant get the refrence for the widget with get all widgets of class

From what I know, you can cast from macro when you want without any problem. Like Vaei say, open a new question to let us know what you try to achieve because I’m pretty sure this isn’t that hard to achieve with custom event/macros.

If you want send a link of the new question here in the comment.

You can maybe create a variable «Object» and get your object like this. Also please follow my advice and create a new question to expose your new problem about casting and macros (or the thing you need exacly).