Quick answer: Enable “Cook for Faster Simulation” (a default) but pre-bake at import via the mesh’s import settings. Disable runtime-only cleaning flags if your meshes are already clean.
A level with hundreds of MeshColliders takes seconds to load. PhysX is cooking collision data for every mesh at scene load.
Cooking Options
On each MeshCollider, the Cooking Options bitmask:
- Cook for Faster Simulation: better runtime perf, slower cook. Keep on.
- Enable Mesh Cleaning: removes degenerate triangles. Needed only for messy source meshes.
- Weld Colocated Vertices: merges duplicate verts.
- Use Fast Midphase: faster broadphase, keep on.
If your meshes are authored clean, disable Mesh Cleaning + Weld — big cook-time savings.
Pre-Bake at Import
Mesh import settings have collision baking. When enabled, the cooked data is stored in the asset; scene load just deserializes it instead of cooking. Verify it’s on for static level geometry.
Prefer Simpler Colliders
MeshColliders are expensive. For most level geometry:
- Box / Capsule / Sphere colliders — near-zero cook cost.
- Convex MeshCollider — cheaper than concave.
- Concave MeshCollider — only for genuinely complex static geo.
Profile Load
Profiler → deep profile a scene load. “Physics.Cook” entries show the cost. Sort meshes by cook time; optimize the worst offenders.
Verifying
Scene loads noticeably faster. Physics still behaves correctly. Profiler shows minimal Physics.Cook time at load.
“Cooking is a one-time cost — move it to import time and skip the flags you don’t need.”
For streamed open worlds, pre-baked collision is essential — cooking on the main thread during streaming causes visible hitches.