Blueprint local variables vs class vars, performance / advantages

I would think your compile times going up is not related to how you manage your variables, but actually, for example, to how many copies of the blueprint you have in your level. Strange, but true.

In any event, it’s generally accepted that the more local variables are, the better. But, that means passing them as parameters, which means a slight inefficiency because they have to be moved via the stack. It wouldn’t really have any effect though unless you’re passing hundreds or thousands of parameters.

Also, have you got the youtube ‘infection’ of using functions where an event is actually needed? Basically, if the process returns a value, then it’s really a function, otherwise it’s a procedure, ie an event. Most of the stuff I see on youtube is using functions where an event is actually what’s needed.

If you are using events, you could excuse using global ( to the blueprint ) variables. Although specifying them as parameters leads to better readability.

One thing’s for sure though, if you intend to reuse a function, then it should go in a function library and have local variables.

1 Like