What's the best way of handling hundreds of objects in an infinite world without killing the framerate?

So, I have an infinite level generator set up.

It basically instantiates tiles (floor + some models on it).

My render/shadow/AO distance is already at around 60, so GPU load is no big problem.

However, it seems having a high amount of objects in general can cause the framerate to go down (noticed that after flying through my world for a while).

All distant objects are still active (because I’m not sure if disabling them might require more performance than leaving them active), they don’t have scripts, but they do affect framerate as the world gets bigger.

Should I apply LOD to every single object? Does culling even affect CPU performance since it’s outside of the clipping plane anyway? Should I disable the meshes when they are far away using triggers?

Thanks in advance.

@N00MKRAD
Disabling them will most likely benefit frame rate from my experience. also using LODS for all your procedural content will help drastically!

Occlusion Culling will definitely help! however, that may require some custom code on your front because unity by default simply bakes in the culling, so any procedural landscape will require your own implementation!

And yes! I have run tests before and culling does do wonders on performance, especially in dense areas of shrubbery.

A simple method could be to simply use the Vector3.Distance, and set a distance threshold that when exceeded, disables the distant object if(Vector3.Distance(player.position, terrainChunk.position) > DistThreshold) terrainChunk.SetActive(false); however better methods are no doubt floating around google!

I hope I have helped you out a little, but long story short, yes disabling the objects far away will definitely benefit performance in a good way! if you need any more help feel free to reply :slight_smile: