Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

ModelImporter.SetPreBakeCollisionMesh

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public void SetPreBakeCollisionMesh(bool isConvex, bool preBake);

Parameters

Parameter Description
isConvex True to configure convex collision mesh data, false to configure triangle collision mesh data.
preBake True to enable pre-baking of the specified collision type, false to disable it.

Description

Enables or disables pre-baking of collision mesh data during player build for all imported meshes.

This method allows you to control whether convex or triangle collision mesh data should be pre-baked during player build for all the imported meshes of that model. Pre-baked collision mesh data improves runtime performance when the mesh is used with a MeshCollider component.

When collision mesh data is not pre-baked, Unity generates the collision representation at runtime, which may impact performance.

Additional resources: HasPreBakeCollisionMesh, MeshCollider.