docs.unity3d.com
    目次を表示する/隠す

    Struct NativeStream.Writer

    Writes data into a buffer of a NativeStream.

    Namespace: Unity.Collections
    Syntax
    [NativeContainer]
    [NativeContainerSupportsMinMaxWriteRestriction]
    public struct Writer
    Remarks

    An individual writer can only be used for one buffer of one stream. Do not create more than one writer for an individual buffer.

    Properties

    ForEachCount

    The number of buffers in the stream of this writer.

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

    The number of buffers in the stream of this writer.

    Methods

    Allocate(Int32)

    Allocate space in a buffer.

    Declaration
    public byte *Allocate(int size)
    Parameters
    Type Name Description
    Int32 size

    The number of bytes to allocate.

    Returns
    Type Description
    Byte*

    The allocation.

    Remarks

    The space is allocated in the buffer which was specified with BeginForEachIndex(Int32).

    Allocate<T>()

    Allocate space in a buffer.

    Declaration
    public ref T Allocate<T>()
        where T : struct
    Returns
    Type Description
    T

    A reference to the allocation.

    Type Parameters
    Name Description
    T

    The type of value to allocate space for.

    Remarks

    The space is allocated in the buffer which was specified with BeginForEachIndex(Int32).

    BeginForEachIndex(Int32)

    Readies this writer to write to a particular buffer of the stream.

    Declaration
    public void BeginForEachIndex(int foreachIndex)
    Parameters
    Type Name Description
    Int32 foreachIndex

    The index of the buffer to write.

    Remarks

    Must be called before using this writer. For an individual writer, call this method only once.

    When done using this writer, you must call EndForEachIndex().

    EndForEachIndex()

    Readies the buffer written by this writer for reading.

    Declaration
    public void EndForEachIndex()
    Remarks

    Must be called before reading the buffer written by this writer.

    PatchMinMaxRange(Int32)

    For internal use only.

    Declaration
    public void PatchMinMaxRange(int foreEachIndex)
    Parameters
    Type Name Description
    Int32 foreEachIndex

    Write<T>(T)

    Write a value to a buffer.

    Declaration
    public void Write<T>(T value)
        where T : struct
    Parameters
    Type Name Description
    T value

    The value to write.

    Type Parameters
    Name Description
    T

    The type of value to write.

    Remarks

    The value is written to the buffer which was specified with BeginForEachIndex(Int32).

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)