Struct NativeStream | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Struct NativeStream

    A deterministic data streaming supporting parallel reading and parallel writing. Allows you to write different types or arrays into a single stream.

    Namespace: Unity.Collections
    Syntax
    public struct NativeStream : IDisposable

    Constructors

    NativeStream(Int32, Allocator)

    Declaration
    public NativeStream(int foreachCount, Allocator allocator)
    Parameters
    Type Name Description
    System.Int32 foreachCount
    Allocator allocator

    Properties

    ForEachCount

    Declaration
    public int ForEachCount { get; }
    Property Value
    Type Description
    System.Int32

    IsCreated

    Declaration
    public bool IsCreated { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    AsReader()

    Declaration
    public NativeStream.Reader AsReader()
    Returns
    Type Description
    NativeStream.Reader

    AsWriter()

    Declaration
    public NativeStream.Writer AsWriter()
    Returns
    Type Description
    NativeStream.Writer

    ComputeItemCount()

    Declaration
    public int ComputeItemCount()
    Returns
    Type Description
    System.Int32

    Dispose()

    Disposes of this stream and deallocates its memory immediately.

    Declaration
    public void Dispose()

    Dispose(JobHandle)

    Safely disposes of this container and deallocates its memory when the jobs that use it have completed.

    Declaration
    public JobHandle Dispose(JobHandle inputDeps)
    Parameters
    Type Name Description
    JobHandle inputDeps
    Returns
    Type Description
    JobHandle

    A new job handle containing the prior handles as well as the handle for the job that deletes the container.

    Remarks

    You can call this function dispose of the container immediately after scheduling the job. Pass the JobHandle returned by the Job.Schedule method using the jobHandle parameter so the job scheduler can dispose the container after all jobs using it have run.

    ScheduleConstruct(out NativeStream, NativeArray<Int32>, JobHandle, Allocator)

    Declaration
    public static JobHandle ScheduleConstruct(out NativeStream stream, NativeArray<int> lengthFromIndex0, JobHandle dependency, Allocator allocator = null)
    Parameters
    Type Name Description
    NativeStream stream
    NativeArray<System.Int32> lengthFromIndex0
    JobHandle dependency
    Allocator allocator
    Returns
    Type Description
    JobHandle

    ScheduleConstruct<T>(out NativeStream, NativeList<T>, JobHandle, Allocator)

    Declaration
    public static JobHandle ScheduleConstruct<T>(out NativeStream stream, NativeList<T> forEachCountFromList, JobHandle dependency, Allocator allocator = null)
        where T : struct
    Parameters
    Type Name Description
    NativeStream stream
    NativeList<T> forEachCountFromList
    JobHandle dependency
    Allocator allocator
    Returns
    Type Description
    JobHandle
    Type Parameters
    Name Description
    T

    ToNativeArray<T>(Allocator)

    Declaration
    public NativeArray<T> ToNativeArray<T>(Allocator allocator)
        where T : struct
    Parameters
    Type Name Description
    Allocator allocator
    Returns
    Type Description
    NativeArray<T>
    Type Parameters
    Name Description
    T

    Extension Methods

    JobNativeMultiHashMapVisitKeyValue.Schedule<TJob, TKey, TValue>(TJob, NativeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    JobNativeMultiHashMapVisitKeyMutableValue.Schedule<TJob, TKey, TValue>(TJob, NativeMultiHashMap<TKey, TValue>, Int32, JobHandle)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023