Class PreBakeCollisionTool
Finds the models a content-directory build refuses to cook, and (optionally) fixes their importers.
Why this exists: UnityEditor.BuildPipeline.BuildContentDirectory(UnityEditor.BuildContentDirectoryParameters) reports, per mesh,
Pre-baked convex collision is not enabled on the mesh 'X' used by a Mesh Collider component … collision
data cannot be baked at runtime and will be empty in a Content Directory build — an error, 104 of
them in the first real build — and Read/Write is disabled on the mesh 'X' used by a Particle System …
component. Built content without this is not merely lighter: the collision data is empty, so the
object has no collider at runtime.
The switches are per model importer, not per mesh: SetPreBakeCollisionMesh(bool, bool)(bool isConvex, bool preBake) and isReadable. Enabling them for every model in the project would cook data nothing uses, so this tool only touches models whose meshes are actually referenced by a MeshCollider or by an enabled mesh-shaped ParticleSystem.
Scope of v1: prefabs only. Scenes are not walked (opening every scene in the project from a menu item is not something a tool should do to a working editor); a MeshCollider that exists only inside a scene will not be found. Scenes that end up inside a content directory will need their own pass.
Menu: GrindFest ▸ Content ▸ Collision pre-bake. Batch: -executeMethod
GrindFest.Content.Editor.PreBakeCollisionTool.ApplyFromBatchMode.
public static class PreBakeCollisionTool
- Inheritance
-
objectPreBakeCollisionTool