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

PhysicsEditorMeshExtensions.HasPreBakeCollisionMesh

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 static bool HasPreBakeCollisionMesh(Mesh mesh, bool isConvex);

Parameters

Parameter Description
mesh The mesh to check.
isConvex True to check for convex collision data, false to check for triangle collision data.

Returns

bool Returns true if the mesh should contain pre-baked collision data in a player build, false otherwise.

Description

Checks whether the mesh should pre-bake collision data during a player build.

When building a player, convex and/or triangle collision data can be pre-baked inside the Mesh. This allows MeshCollider referencing that Mesh to efficiently fetch that collision data at runtime.

When no collision data is pre-baked, it will be generated at runtime when the mesh is used with a MeshCollider, which can have an impact on performance.

Note that the collision data is only baked during a player build, so if the methods returns true but the mesh hasn't been built yet as part of player build, it means it doesn't contain any pre-baked collision data yet.

Additional resources: SetPreBakeCollisionMesh, ModelImporter.SetPreBakeCollisionMesh, MeshCollider.