# OverlapSphere(Vector3, float, Collider[], int, QueryTriggerInteraction)

> Computes and stores colliders touching or inside the sphere into the provided buffer.

## Definition

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

```csharp
public int OverlapSphere(Vector3 position, float radius, Collider[] results, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
```

### Parameters

**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): Center of the sphere.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Radius of the sphere.**** (\[Collider\[]]\(/engine/6000.0/script-reference/unityengine/collider)): The buffer to store the results into.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): A Layer mask that is used to selectively ignore colliders when casting a ray.**** (\[QueryTriggerInteraction]\(/engine/6000.0/script-reference/unityengine/querytriggerinteraction)): Specifies whether this query should hit Triggers.

### Returns

| Type                                                       | Description                                                                                                                                                           |
| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of colliders detected that overlap with the sphere and were stored in the `results` array. The return value cannot exceed the size of the `results` array. |

### Remarks

Additional Resources: [Physics.OverlapSphereNonAlloc](/engine/6000.0/script-reference/unityengine/physics/overlapspherenonalloc.md).
