docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetWriteSize

    GetWriteSize(string, bool)

    Get the required size to write a string

    Declaration
    public static int GetWriteSize(string s, bool oneByteChars = false)
    Parameters
    Type Name Description
    string s

    The string to write

    bool oneByteChars

    Whether or not to use one byte per character. This will only allow ASCII

    Returns
    Type Description
    int

    GetWriteSize<T>(T[], int, int)

    Get the required size to write an unmanaged array

    Declaration
    public static int GetWriteSize<T>(T[] array, int count = -1, int offset = 0) where T : unmanaged
    Parameters
    Type Name Description
    T[] array

    The array to write

    int count

    The amount of elements to write

    int offset

    Where in the array to start

    Returns
    Type Description
    int
    Type Parameters
    Name Description
    T

    GetWriteSize<T>(NativeArray<T>, int, int)

    Get the required size to write a NativeArray

    Declaration
    public static int GetWriteSize<T>(NativeArray<T> array, int count = -1, int offset = 0) where T : unmanaged
    Parameters
    Type Name Description
    NativeArray<T> array

    The array to write

    int count

    The amount of elements to write

    int offset

    Where in the array to start

    Returns
    Type Description
    int
    Type Parameters
    Name Description
    T

    GetWriteSize<T>(in T, ForStructs)

    Get the write size for any general unmanaged value The ForStructs value here makes this the lowest-priority overload so other versions will be prioritized over this if they match

    Declaration
    public static int GetWriteSize<T>(in T value, FastBufferWriter.ForStructs unused = default) where T : unmanaged
    Parameters
    Type Name Description
    T value
    FastBufferWriter.ForStructs unused
    Returns
    Type Description
    int
    Type Parameters
    Name Description
    T

    GetWriteSize<T>(in T)

    Get the write size for a FixedString

    Declaration
    public static int GetWriteSize<T>(in T value) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    T value
    Returns
    Type Description
    int
    Type Parameters
    Name Description
    T

    GetWriteSize<T>(in NativeArray<T>)

    Get the write size for an array of FixedStrings

    Declaration
    public static int GetWriteSize<T>(in NativeArray<T> value) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    NativeArray<T> value
    Returns
    Type Description
    int
    Type Parameters
    Name Description
    T

    GetWriteSize<T>()

    Get the size required to write an unmanaged value of type T

    Declaration
    public static int GetWriteSize<T>() where T : unmanaged
    Returns
    Type Description
    int
    Type Parameters
    Name Description
    T
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)