| Parameter | Description |
|---|---|
| mesh | The mesh to configure. |
| isConvex | True to configure convex collision data, false to configure triangle collision data. |
| preBake | True to enable pre-baking of the specified collision data, false to disable it. |
Enables or disables pre-baked collision data for this mesh.
This method allows you to control whether convex or triangle collision data should be pre-baked into this mesh during a player build. Pre-baking collision data improves runtime performance when the mesh is used with a MeshCollider component by avoiding the need to generate collision representations dynamically.
This method is typically used in editor scripts to configure collision data for mesh assets. After calling this method, you should save the asset using AssetDatabase.SaveAssetIfDirty, so that collision data can be baked during a player build.
To configure collision data during mesh import from a ModelImporter, use ModelImporter.SetPreBakeCollisionMesh instead.
Additional resources: HasPreBakeCollisionMesh, ModelImporter.SetPreBakeCollisionMesh, MeshCollider.