So I’m pretty far with my project, but now I noticed that performance is terrible inside the editor when playing. I have 100+ blueprints and UMG widgets inside my project, and the performance is now terrible. when not playing the game or when in the main menu of my game I have 60 FPS. The moment I get in my playable level, and use my TopdownController, the FPS drops to 10-15 FPS.
So my first question is, how do you write performant code, are there any good practises to follow that you can think of that you maybe did wrong at first but now know how to do better?
i.e. I have alot of code where I cast to the same object multiple times. i.e. Get Player Controller -> Cast to TopDownController. Would it increase performance if I made references to the topdownController in the beginplay and then call the reference instead of casting each time? Now that I know more about blueprints it kind of makes sense that it would be more performant, so if I make references everywhere in my 100+ blueprints/widgets, will that significantly increase performance?
for my second question, I have bad performance inside the unreal editor when playing. it runs at 10-15 FPS. But when I package my game, it all runs smooth at 62-63 FPS. I can only find questions on google/answerhub that have the reverse effect, where it runs smooth in the editor but slow when packaged.
What might be going on here? why is my packaged game running at 62FPS, and in the editor only 10-15 FPS?
Thanks in advance!