# SetBatchProxyCategories(ReadOnlySpan<ProxyHandle>, ReadOnlySpan<PhysicsMask>)

> Set a batch of proxy categories, where the categories at each index are set on the corresponding proxy at the same index. The two spans must be the same length. This can be an expensive operation as all ancestors need to be recalculated. Any invalid proxy handle in the batch is skipped and reported with a single warning.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

```csharp
public int SetBatchProxyCategories(ReadOnlySpan<PhysicsSpace.ProxyHandle> proxyHandles, ReadOnlySpan<PhysicsMask> categories)
```

### Parameters

**** (\[ReadOnlySpan\<ProxyHandle>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The proxies to set.**** (\[ReadOnlySpan\<PhysicsMask>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The categories as a physics mask to set on each corresponding proxy.

### Returns

| Type                                                       | Description                                                                                                                                                                                               |
| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The number of proxies that were ignored (not set because the proxy handle was invalid). If the space is invalid or the spans are different lengths, nothing is set and every proxy is counted as ignored. |
