Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported
Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported since Unity 5. If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component.
A GameObject has a dynamic Rigidbody and a MeshCollider whose Convex box is unticked. The physics engine can only simulate moving bodies with convex shapes, so the collider is ignored for that body.
Read the Console line first
The message ends with the object's hierarchy path and the mesh asset, so you know exactly which object to fix.
Common causes
A detailed model got a MeshCollider and a Rigidbody
Adding a Rigidbody to a prop that already has an imported MeshCollider, such as a barrel, crate or vehicle body, gives a dynamic body a concave shape.
The model was imported with Generate Colliders
The model importer's Generate Colliders option adds non-convex MeshColliders to every mesh. That suits static level geometry, not objects that move.
The fix
// Tick Convex on the MeshCollider in the Inspector, or from code:
GetComponent<MeshCollider>().convex = true;
// For a shape that must keep its hollows, build it from several
// Box, Sphere and Capsule colliders on child objects instead.Stop it coming back
Use MeshColliders without Convex only for static level geometry. Give moving objects primitive colliders, which are faster and more stable, or a convex MeshCollider when the shape matters.
Questions
- Does ticking Convex change the shape?
- Yes. A convex collider wraps the mesh like shrink-wrap, filling hollows and holes, and is limited to 255 triangles. For a cup or a vehicle with an open cabin, build the shape from several primitives instead.
- When is a kinematic Rigidbody the right fix?
- When the object is moved by animation or code, not by forces: a moving platform or a door. A kinematic body may keep a concave MeshCollider, and it still pushes dynamic bodies.
- Is it the same in 2D?
- 2D physics has no MeshCollider. Use a PolygonCollider2D or CompositeCollider2D, which handle concave outlines on moving bodies.
Scripts that avoid it
Related errors
Got a different error? Paste it into the error lookup.