r/programminghorror • u/TemporaryCurrent1172 • Apr 09 '26
Blueprint Spaghetti Code
Welp, my code in blueprints... kinda looks yummy
(Blueprint is a type of visual coding in unreal engine just so you guys know)
791
Upvotes
View all comments
Show parent comment
2
u/duffking Apr 10 '26
You could cut down a lot of the spaghetti by caching function results to variables.
It's not just a benefit for readability but also for performance. The "pure" nodes that don't have the white exec pins will re run every time their value is used, so connecting one to 10 places will cause the node to rerun for each of those 10 places. Caching and accessing a variable will cut it to one.
That cascades by the way, so a pure nodes that reruns will also cause any pure nodes connected to its input pins to rerun too. That includes inputs to for loops, because they're actually macros.