# ScheduleBatch

> Schedule a batch of raycasts to perform in a job.

## Definition

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

## ScheduleBatch(NativeArray\<RaycastCommand>, NativeArray\<RaycastHit>, int, int, JobHandle)

Schedule a batch of raycasts to perform in a job.

```csharp
public static JobHandle ScheduleBatch(NativeArray<RaycastCommand> commands, NativeArray<RaycastHit> results, int minCommandsPerJob, int maxHits, JobHandle dependsOn = default)
```

### Parameters

**** (\[NativeArray\<RaycastCommand>]\(/engine/6000.0/script-reference/unity/collections/nativearray1)): A NativeArray of the RaycastCommands to perform.**** (\[NativeArray\<RaycastHit>]\(/engine/6000.0/script-reference/unity/collections/nativearray1)): A NativeArray of the RaycastHits where the results of the commands are stored.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The minimum number of commands to perform in a single job.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum number of Colliders the ray can hit.**** (\[JobHandle]\(/engine/6000.0/script-reference/unity/jobs/jobhandle)): A JobHandle of a job which must be completed before the raycast starts.

### Returns

| Type                                                                 | Description                                               |
| -------------------------------------------------------------------- | --------------------------------------------------------- |
| [JobHandle](/engine/6000.0/script-reference/unity/jobs/jobhandle.md) | The JobHandle of the job which will perform the raycasts. |

## ScheduleBatch(NativeArray\<RaycastCommand>, NativeArray\<RaycastHit>, int, JobHandle)

Schedule a batch of raycasts to perform in a job.

```csharp
public static JobHandle ScheduleBatch(NativeArray<RaycastCommand> commands, NativeArray<RaycastHit> results, int minCommandsPerJob, JobHandle dependsOn = default)
```

### Parameters

**** (\[NativeArray\<RaycastCommand>]\(/engine/6000.0/script-reference/unity/collections/nativearray1)): A NativeArray of the RaycastCommands to perform.**** (\[NativeArray\<RaycastHit>]\(/engine/6000.0/script-reference/unity/collections/nativearray1)): A NativeArray of the RaycastHits where the results of the commands are stored.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The minimum number of commands to perform in a single job.**** (\[JobHandle]\(/engine/6000.0/script-reference/unity/jobs/jobhandle)): A JobHandle of a job which must be completed before the raycast starts.

### Returns

| Type                                                                 | Description                                               |
| -------------------------------------------------------------------- | --------------------------------------------------------- |
| [JobHandle](/engine/6000.0/script-reference/unity/jobs/jobhandle.md) | The JobHandle of the job which will perform the raycasts. |

### Remarks

By default maxHits in this variant is set to 1.
