I’m wondering if it’s acceptable to create variables in order to clean up BPs and make them appear neater, which would make them more easily navigable and improve readability.
Here is an example where I create 3 “useless” (technically unneeded) local variables to improve neatness, before and after:
Should I do this? Does it affect performance? Bad standards?
It’s mostly fine if they’re local variables (since they’ll be destroyed after the function is over) but I’d really recommend against using more memory in the game just to improve the experience in the editor. Now that reroutes can be created with a double-click, I feel like you can get great readable results by just liberally applying them all over. Ultimately it’s up to you, but variables are not free. As long as you’re aware of the extra memory being constantly loaded and unloaded you can do as you please
Personally I prefer this method too since you may want to use those variables elsewhere later on so it’s better practice to have them as a variable rather than calling them directly.
As far as performance goes I can’t really see it having any affect on it unless you have 10s of thousands of them.
Seems like a double edged sword…
On one hand, of course I’d like to use the least amount of memory possible, but on the other, I may release what I’m working on and I’d like people to be able to easily follow along… I’ll probably only do this is even with reroute nodes it’s still a tangled mess.
Thanks for the replies !
Double-click to Reroute has become my standard. I do it automatically when I’m cleaning things up, it just makes things look nicer. Throw in a Comment box, drop a Reroute at the edge of the box and you have a nice flow to your lines.
Variables take up the memory, that is true, but like ZoltanJr stated you would have to use 10s of thousands of them to notice any real performance issues due to excessive variables.
It all comes down to personal preference, what you think looks best to you. Personally, I do both.