# useAutoMass

> Should the total rigid-body _mass be automatically calculated from the _density of attached colliders?

## Definition

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

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

### Remarks

When false, the explicitly set [\_mass](/engine/6000.7/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.7/script-reference/unityengine/collider2d.md) as a product of their [\_density](/engine/6000.7/script-reference/unityengine/collider2d/density.md) and area.

When true, inside the Unity editor, the [\_density](/engine/6000.7/script-reference/unityengine/collider2d/density.md) property will appear on any attached [Collider2D](/engine/6000.7/script-reference/unityengine/collider2d.md) and the [\_mass](/engine/6000.7/script-reference/unityengine/rigidbody2d/mass.md) property will become read-only.

When false, the [\_mass](/engine/6000.7/script-reference/unityengine/rigidbody2d/mass.md) property can be written to and the [\_density](/engine/6000.7/script-reference/unityengine/collider2d/density.md) property is not shown.

Additional Resources: [\_mass](/engine/6000.7/script-reference/unityengine/rigidbody2d/mass.md), [\_density](/engine/6000.7/script-reference/unityengine/collider2d/density.md)
