x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Force function to finish first

So I´m currently getting some errors and the only thing that would explain this is that the function gets called, but the execution pin instantly continues without waiting the function to be finished... Or am I missing something here? Do I really have to use event dispatchers so I can be sure the function has finished?

alt text

Product Version: UE 4.21
Tags:
functionwait.jpg (84.8 kB)
more ▼

asked Mar 11 '19 at 03:29 PM in Blueprint Scripting

avatar image

Andyhdr
58 1 7

avatar image the_batch Mar 11 '19 at 04:18 PM

Are you sure the function isn't finishing before execution continues? Everything that runs on the main game thread gets processed in a straightforward and predictable order.

Is it possible your function is spawning worker threads somehow? Is it using operating system libraries to modify files, which may, in turn, be doing something with multi-threading?

What exactly does that Cleanup Folder function do? Maybe with more information, we can better help you identify the problem.

avatar image Andyhdr Mar 11 '19 at 07:30 PM

I guess this must be the problem. I´m working with the asset regestry and rename files inside of this function. Since it is used in the editor, not at runtime it is reallý difficult to debug. Thank you for pointing me in the right direction!

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

It's because that's not a function, it's an event. A function is denoted by an "f" instead of an arrow.

When an event is triggered the event calculates seperate from the event chain that triggered it. It does not need to be completed for the original event chain to continue down its path. If you need calculations to finish before moving on, you either use a function, an event for moving on or a variable.

So in this case, end the execution event at Cleanup Folder. Add an event called "Continue" for example and plug that into the first branch in "Geometry". At the end of Cleanup Folder add a call to that event.

Here's a visual representation of that:

alt text

example03.png (120.0 kB)
more ▼

answered Mar 11 '19 at 05:22 PM

avatar image

Crowley Caine
643 8 9 15

avatar image Andyhdr Mar 11 '19 at 07:52 PM

Actually it was a function. But you pointed me in the right direction here. If a function doesn´t have an output the "f" disappears and it is handeled as an event. I added an empty output to my function and now it gets executed first. I was never aware of this.

avatar image Crowley Caine Mar 11 '19 at 07:54 PM

A return node should serve the exact same purpose. Either way, you have options.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question