Best practice: Level loading/culling?

Hi everybody,

I need some help with my new game. It’s a 2.5D sidescrolling racing game. The ground consists of several segments and has some physics obstacals and decoration on it. At the moment I’m loading everything at the beginning of the level and don’t do any culling myself.

Here’s a sketch of the situation:

Now my questions:

  • Does Unity 3d all the culling?
  • Does Unity culling also affect physics objects? Meaning are they switched off when they are not visible?
  • Is there a big overhead of the objects (segments) not visible?
  • Should I do some culling by myself?
  • What would be the best practice here? Dynamically loading and unloading the segments, or just putting all segments to the scene at the beginning of the level?

Any help would be really appreciated.

Thanks and best regards,
Matthias

Unity uses frustum culling so assets which are currently not visible to any camera won’t be rendered - in your example that would be segments3+ plus the physic objects you marked.
Physics calculation however is still processed, frustum culling only affects renderers.

Therefore, depending on what’s actually happing in your level, amount of objects and alike you may e.g. want to make sure that certain objects or components of those are disabled as long as they are not needed and only activate them once the object becomes visible (OnBecameVisible()) - just as an example.

Also for your question whether to put everything in on load or dynamically - depends, but I’d load them all and deactivate unnecessary parts. However this depends on the amount of segments you are going to have, the platform you are targetting and so on.

Hi Glockenbeat,

thanks for your reply and your great explanation! That helps a lot. I didn’t know that something like “OnBecameVisible()” existed :slight_smile: That should make things easier…

Thanks and best regards from Cologne to Cologne :wink: