Download

What happens if an event is called again when it's still running?

Hi, What happens if an event that is still running gets called again?
Considering that there is no delay nodes in this event.

An event is simply like a method in other kanguages.
when an event is called from within the same event , it is called recursion.

When there is a delay, the delay is executed and that is it.

Simply try it out. When you call it several times from outside it is simply executed several times.

There are no x threads running, which execute it at the same time. It is simply executed one after another.

1 Like

Thank you, so an event is not called more than once at the same time?

If this didn’t answer your question, you have to ve more specific and give some example or simply try it out.

Yes that answers, but where could i find any documentation for questions like this?
And thanks again.

When you call an event, the entire chain of nodes that follow will execute before another of the same bp occur. There are some cases where events can occur at the same time, but generally you want to make sure you do not call events that rely on the same data that one event may change in the other. Generally, executions happen one after another (again, in the same bp).

Calling the same event more than once will execute the entire chain, once that finishes it, it will perform it again. For example, running some kind of logic on Tick. So in some cases, depending on the logic therein, it can “lag” moments in gameplay since processing a chain of nodes could end up being intensive (we’re talking an extra millisecond or so). Calling GetAllActorsOfClass on Tick, for example, where it must fetch a considerable number (like 1000) of actors followed by a loop check of some sort can cause such a hitch - this of course depends on the hardware it is run on.

This kind of question is the kind of knowledge gained from tutorials, forums, and documentation on a whim. It’s a gem of information that I don’t believe is anywhere specific because it is so broad.

2 Likes

Everything in BP runs on what is called the “GameThread”, nothing else can run if something else is running. So “YourEvent” will never actually be running twice at the same time, its not possible.

Caveat to this though is if you have something Latent or Async. These will fire at a time in the future, so your event can run again after and this can lead to possibly undesirable results.

3 Likes

Thank you so much guys.