# SetDensity(float, bool)

> Set the shape density. See PhysicsBody.massConfiguration.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.LowLevelPhysics2D](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d.md)
* **Assembly:** UnityEngine.Physics2DModule

```csharp
public void SetDensity(float density, bool updateBodyMass)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The density to set.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to update the body mass configuration. Not doing so is faster, especially when setting multiple shapes.
