# ScheduleConstruct

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

## Definition

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

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

Creates and schedules a job to allocate a new stream.

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

### Parameters

**** (\[UnsafeStream]\(/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafestream)): 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(UnsafeStream, NativeArray\<int>, JobHandle, AllocatorHandle)

Creates and schedules a job to allocate a new stream.

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

### Parameters

**** (\[UnsafeStream]\(/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafestream)): 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 on the main thread after completing the returned job or used 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.
