Cast To End Node Output to Multiple References Will Break Things Potentially ??

I was browsing the web and randomly come across a topic, according to the discussion, I heard that outputing a cast to node to multiple references might break some codes in strange ways.
Just reposting here to clearify it, I think if this is true, a lot of people might not be aware of it just as I am. This is someone else’s BP graph, I’m just pasting it here as reference.
Is this true? We should always promote the cast to as a variable instead of connecting the blue lines if there are multiple reference it needs to connect??
Thanks in advance !

Generally, it’s not a problem. But you see a lot of awful coding on the ‘interweb’, and some people like to do the cast on one branch of code, and think it’s ok to pull the variable on another. We’re talking about another branch, where the code has not run.

lol yeah that’s indeed a common pitfall that some people fall into.
However, is each blue line represented as each individual cast? like if I have 3 bluelines at the end of a cast node, does that equal to casting 3 times? I think this is where things get a bit confusing for me.

1 Like

Because the cast is run like an impure function, I’m pretty sure the result is written to a temp variable.

See others discussing it here

1 Like