# ScheduleConstruct

> Creates and schedules a job to allocate a new stream.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections](/engine/6000.7/script-reference/unity/collections.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## ScheduleConstruct\<T>(NativeStream, NativeList\<T>, JobHandle, AllocatorHandle)

Creates and schedules a job to allocate a new stream.

```csharp
public static JobHandle ScheduleConstruct<T>(out NativeStream stream, NativeList<T> bufferCount, JobHandle dependency, AllocatorManager.AllocatorHandle allocator) where T : unmanaged
```

### Parameters

**** (\[NativeStream]\(/engine/6000.7/script-reference/unity/collections/nativestream)): Outputs the new stream.**** (\[NativeList\<T>]\(/engine/6000.7/script-reference/unity/collections/nativelist1)): A list whose length determines the number of buffers in the stream.**** (\[JobHandle]\(/engine/6000.7/script-reference/unity/jobs/jobhandle)): A job handle. The new job will depend upon this handle.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The allocator to use.

### Returns

| Type                                                                 | Description                |
| -------------------------------------------------------------------- | -------------------------- |
| [JobHandle](/engine/6000.7/script-reference/unity/jobs/jobhandle.md) | The handle of the new job. |

### Remarks

The stream can be used on the main thread after completing the returned job or used in other jobs that depend upon the returned job.

Using a job to allocate the buffers can be more efficient, particularly for a stream with many buffers.

## ScheduleConstruct(NativeStream, NativeArray\<int>, JobHandle, AllocatorHandle)

Creates and schedules a job to allocate a new stream.

```csharp
public static JobHandle ScheduleConstruct(out NativeStream stream, NativeArray<int> bufferCount, JobHandle dependency, AllocatorManager.AllocatorHandle allocator)
```

### Parameters

**** (\[NativeStream]\(/engine/6000.7/script-reference/unity/collections/nativestream)): Outputs the new stream.**** (\[NativeArray\<int>]\(/engine/6000.7/script-reference/unity/collections/nativearray1)): An array whose value at index 0 determines the number of buffers in the stream.**** (\[JobHandle]\(/engine/6000.7/script-reference/unity/jobs/jobhandle)): A job handle. The new job will depend upon this handle.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The allocator to use.

### Returns

| Type                                                                 | Description                |
| -------------------------------------------------------------------- | -------------------------- |
| [JobHandle](/engine/6000.7/script-reference/unity/jobs/jobhandle.md) | The handle of the new job. |

### Remarks

The stream can be used...

* after completing the returned job

* or in other jobs that depend upon the returned job.

Allocating the buffers in a job can be more efficient, particularly for a stream with many buffers.

## ScheduleConstruct(NativeStream, NativeReference\<int>, JobHandle, AllocatorHandle)

Creates and schedules a job to allocate a new stream.

```csharp
public static JobHandle ScheduleConstruct(out NativeStream stream, NativeReference<int> bufferCount, JobHandle dependency, AllocatorManager.AllocatorHandle allocator)
```

### Parameters

**** (\[NativeStream]\(/engine/6000.7/script-reference/unity/collections/nativestream)): Outputs the new stream.**** (\[NativeReference\<int>]\(/engine/6000.7/script-reference/unity/collections/nativereference1)): The number of buffers in the stream.**** (\[JobHandle]\(/engine/6000.7/script-reference/unity/jobs/jobhandle)): A job handle. The new job will depend upon this handle.**** (\[AllocatorHandle]\(/engine/6000.7/script-reference/unity/collections/allocatormanager/allocatorhandle)): The allocator to use.

### Returns

| Type                                                                 | Description                |
| -------------------------------------------------------------------- | -------------------------- |
| [JobHandle](/engine/6000.7/script-reference/unity/jobs/jobhandle.md) | The handle of the new job. |

### Remarks

The stream can be used...

* after completing the returned job

* or in other jobs that depend upon the returned job.

Allocating the buffers in a job can be more efficient, particularly for a stream with many buffers.
