How do I get better performance with lots of instances in my game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GreenPhotonRays

Im currently working on a small little project to improve my programming skills. It’s something like a 2D top-down Zelda like game. The Code works fine and everything was good until i noticed the game itself wasn’t running that good on ‘normal’ computers (btw. I have a pretty good pc I guess). I think I already know why this is the case. i have got a lot of random generated instances of my tree node (exact amount: 100) in my world. Do you know how to get more performance but having still the same amount of instances?


:bust_in_silhouette: Reply From: rossunger

100 instances is not many at all, I doubt that that is what is causing the issue.

Have you tried using the profiler in the debug panel at the bottom of the editor? It can tell you what’s happening frame by frame and what’s using up the resources.

Thank you very much!

I saw, that the most of the performance was taken by the tree instances, but this made me overlook my code and I saw that I had used for the max value from the random generated trees not 100 but 1000 and that makes a huge difference now. Thanks!

GreenPhotonRays | 2022-02-11 20:11