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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Multiple node output links == multiple executions?

Hey, I'm still not sure how it works:

alt text

As you can see on the image. In this case, is the multiply node (and everything linked to it before) executed twice? If so, then from optimization perspective it's better to save this to a local variable and then reuse it - so this way it would execute only once, and then access already calculated value from local variable.

... But maybe there is some automatic optimization happening already? Has anybody have an idea on how this works? Cheers!

Product Version: UE 4.15
Tags:
more ▼

asked Apr 24 '17 at 01:43 PM in Blueprint Scripting

avatar image

Slavq
2k 157 153 207

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Long answer short: Yes it is executed twice.

In their last livestream getting started with code or something like that, they talked about pure functions and this.

If you want it to be only calculated once you have to store it in a variable.

-Erik

more ▼

answered Apr 27 '17 at 08:38 AM

avatar image

erik321123
408 17 15 31

avatar image Slavq May 02 '17 at 11:06 PM

According to @Miroac answer, it'd be executed only once though...? (if I understand it correctly) Thanks!

avatar image erik321123 May 03 '17 at 07:58 AM

If you have a node without execution pin, the code that is connected to that node will fire the amount of times you connected its output to other nodes. To prevent it from executing multiple times you have to promote the output to a variabele.

avatar image Miroac May 03 '17 at 08:06 AM

erik may be correct on this one. I was referencing a source from a while back that I cannot find to verify.

avatar image Slavq May 03 '17 at 02:08 PM

OK, thank you both for the answers!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey Slavq,

From what I can tell from your graph I believe you should only be executing it once.

I can't remember where the flow explanation was but from memory it works something like this:

alt text

Once an execution node is called it started from the calculation furthest back and than calculates forward. So the multiplication is called only once.

Below is an example of when it would have to calculate it twice:

alt text

In this example, because the section commented in purple is begin called by the red and blue execution function/macros, they will run their calculations twice.

Where as the float x 2 calculations that are commented in blue only get called once because they are only called by the section function/macro also highlighted in blue.

Below I've tried to highlight the flow, where you will see the first calculations are highlighted twice:

![alt text][3]

more ▼

answered Apr 27 '17 at 05:45 AM

avatar image

Miroac
728 20 25 108

avatar image Slavq May 02 '17 at 11:08 PM

Thank you! But if I understand correctly, we have two contradicting answers right here... ? :) ( @erik321123 answer )

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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