# useAutoMass

> Should the total rigid-body Rigidbody2D.mass be automatically calculated from the <see cref= "\> of attached colliders?

## Definition

* **Type:** Property
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule

```csharp
public bool useAutoMass { get; set; }
```

### Remarks

When false, the explicitly set [Rigidbody2D.mass](/engine/6000.0/script-reference/unityengine/rigidbody2d/mass.md) is used for the rigid-body mass.  When true, the mass is automatically calculated from all attached [Collider2D](/engine/6000.0/script-reference/unityengine/collider2d.md) as a product of their \<see cref="[Collider2D.density](/engine/6000.0/script-reference/unityengine/collider2d/density.md)"> and area.

When true, inside the Unity editor, the \<see cref="[Collider2D.density](/engine/6000.0/script-reference/unityengine/collider2d/density.md)"> property will appear on any attached [Collider2D](/engine/6000.0/script-reference/unityengine/collider2d.md) and the [Rigidbody2D.mass](/engine/6000.0/script-reference/unityengine/rigidbody2d/mass.md) property will become read-only.

When false, the [Rigidbody2D.mass](/engine/6000.0/script-reference/unityengine/rigidbody2d/mass.md) property can be written to and the \<see cref="[Collider2D.density](/engine/6000.0/script-reference/unityengine/collider2d/density.md)"> property is not shown.

Additional Resources: [Rigidbody2D.mass](/engine/6000.0/script-reference/unityengine/rigidbody2d/mass.md), ::[Collider2D.density](/engine/6000.0/script-reference/unityengine/collider2d/density.md).
