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,
Culling is only for visibility, meaning that the camera will not use resources to display culled objects. Without doing anything Unity will automatically cull objects that are outside of the camera view frustum.
Culling do not affect physics objects, physics will continue to be calculated on all objects outside of view. Though if nothing happens to physics objects for a while, physics will stop being calculated on them (they go to sleep) and only a change in collision will wake them up.
There is usually not a big overhead on objects that are not visible, but it really depends on the objects. Big objects take up more memory and physics objects still gets physics calculations and so on.
You could do some Occlusion Culling which will cull objects that are behind other objects but still inside the cameras view frustum. This is a Unity Pro feature though and with a 2.5D game like your I don’t think it is really necessary to use Occlusion Culling.
There is no best practice when it comes to such things, it all depends on your specific game an target platform. If the level has a large number of segments and it takes a lot of time to load it up on your target platform, or it even takes to much memory, it could then benefit from dynamically loading and unloading the segments. Again it all depends on your game and platform.