# SetDensity(float)

> Sets the mass based on the attached colliders assuming a constant density.

## Definition

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

```csharp
public void SetDensity(float density)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)):&#x20;

### Remarks

This is useful to set the mass to a value which scales with the size of the colliders.
