In my First bigger Project I at This Point in time habe around 35 different variables in my Main Pawn, some of them in Arrays to Keep a better overview.
Now my question is if there is something like a best practice for handling variables inside of a pawn.
Is the number of variables I’m using considered a lot, too much, or maybe still a little compared to the average project?
Is the performance suffering from too many variables?
What costs more performance, many single variables or fewer arrays?
To give some more detail: I’m using
6 Arrays of which 4 contain floats, 1 integers and 1 strings
12 flouts
2 names
16 Booleans
Is doesn’t really matter how much variables you have/use. Things that breaks performance are difficult/heavy calculated with many steps before setting a variable. Using an array can give its advantages, depending on what you need and how you want to use it for which goal.
But a real best-practice for variables… Is mostly coming down on naming them correctly.
I sometimes fear I do to many calculation per tick, however most of that is fairly simply, some reading, multiplication, comparing and so on. I think I should be fine.
that isnt really right. if tick were not meant to be used then it wouldnt have been exposed in blueprint. also you can modify tick in your actors so it runs less often. really though as long as its used smartly and or in moderation its fine.
now i would agree that in many cases there is a better more performant way to do things but its also dependant on the situation.