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"

If multiple splines are branching off the same output pin of a function, is the function recalculated for each branch or do they simply refer to an implicity stored local variable?

I know that for functions that have an exec pin, having multiple branches off of an output pin does not recalculate the function (for example, having multiple branches off of the hit result of a line trace won't run the trace multiple times). On the other hand, functions that do not have exec pins but have a non-deterministic output based on the input will re-run the function again (for example, if you have two branches coming off of GetActorLocation, but SetActorLocation is called before the second branch is used, then sensibly each branch will return a different value). What I want to know is if a function does not have an exec pin but its output is deterministic based on its input (adding the same two vectors will always yield the same result), will it follow the first behavior type or the second?

The reason for this question is that my current project contains many complex vector calculations that are done every tick, in which I have many instances of multiple splines branching off of the same output pins and have realized that if the functions are recalculated for every branch then many unnecessary calculations are occurring. This situation is very solvable with the implementation of local variables, but I want to know if it is necessary because refactoring most of my current blueprints will take a while.

(In case its not clear, whenever I talk about branching, I am referring to pulling multiple splines off the same (non-exec) output pin, rather than the "Branch" flow control node)

Product Version: UE 4.20
more ▼

asked Dec 15 '18 at 05:37 AM in Blueprint Scripting

avatar image

3 1 2

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

1 answer: sort voted first

Few times I have checked source files after packaging with enabled blueprint nativization, and result of every function is always stored in some variable, so yes, function called once and result used for all further calculations.

You can check it by yourself. Enable blueprint nativization in project settings and package it. Source files will be located in Intermediate folder.


more ▼

answered Dec 15 '18 at 06:27 AM

avatar image

4.3k 82 20 104

avatar image BiopticSeven Dec 17 '18 at 02:36 PM

Damn dude you're right! I just tested the nativization process with several different graph configurations in a custom project. It seems that non-exec-pin functions are are run (and their output stored in an implicit local variable) once per exec-pin function that they are connected to (either directly or indirectly through other non-exec-pin functions). alt text

In fig 1, the collection of non-exec-pin functions are connected to a single exec-pin function, and so the "+ 10" node is run only once and its value stored even though it is connected to two other nodes. In figure 2 however, although the output of the "+ 10 node" is always the same, due to the fact that it is connected to two exec-pin functions, it is run twice.

This is perfect behavior, the guys at Epic are geniuses.

capture.png (91.4 kB)
(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