docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class FixedArraySerializationUtils

    Helper class used by codegen for accessing fixed size containers as span

    Inheritance
    object
    FixedArraySerializationUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.NetCode.LowLevel.Unsafe
    Assembly: Unity.NetCode.dll
    Syntax
    public static class FixedArraySerializationUtils

    Methods

    ToReadOnlySpan<TElement>(ref FixedList128Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static ReadOnlySpan<TElement> ToReadOnlySpan<TElement>(this ref FixedList128Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList128Bytes<TElement> container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    ReadOnlySpan<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged element type

    ToReadOnlySpan<TElement>(ref FixedList32Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged fixed list reference.

    Declaration
    public static ReadOnlySpan<TElement> ToReadOnlySpan<TElement>(this ref FixedList32Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList32Bytes<TElement> container

    The fixed list reference

    int length

    The number of elements

    Returns
    Type Description
    ReadOnlySpan<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged argument type

    Remarks

    Use with cautions, because internally uses the CreateSpan<T>(ref T, int)

    ToReadOnlySpan<TElement>(ref FixedList4096Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static ReadOnlySpan<TElement> ToReadOnlySpan<TElement>(this ref FixedList4096Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList4096Bytes<TElement> container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    ReadOnlySpan<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged element type

    ToReadOnlySpan<TElement>(ref FixedList512Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static ReadOnlySpan<TElement> ToReadOnlySpan<TElement>(this ref FixedList512Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList512Bytes<TElement> container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    ReadOnlySpan<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged element type

    ToReadOnlySpan<TElement>(ref FixedList64Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static ReadOnlySpan<TElement> ToReadOnlySpan<TElement>(this ref FixedList64Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList64Bytes<TElement> container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    ReadOnlySpan<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged element type

    ToReadOnlySpan<TContainer, TElement>(ref TContainer, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static ReadOnlySpan<TElement> ToReadOnlySpan<TContainer, TElement>(ref TContainer container, int length) where TContainer : unmanaged where TElement : unmanaged
    Parameters
    Type Name Description
    TContainer container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    ReadOnlySpan<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TContainer

    The unmanged container type

    TElement

    The unmanged element type

    ToSpan<TElement>(ref FixedList128Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static Span<TElement> ToSpan<TElement>(this ref FixedList128Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList128Bytes<TElement> container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    Span<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged element type

    ToSpan<TElement>(ref FixedList32Bytes<TElement>, int)

    Creates a new Span over a portion of a regular unmanaged fixed list reference.

    Declaration
    public static Span<TElement> ToSpan<TElement>(this ref FixedList32Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList32Bytes<TElement> container

    The fixed list reference

    int length

    The number of elements

    Returns
    Type Description
    Span<TElement>

    A new Span starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged argument type

    Remarks

    Use with cautions, because internally uses the CreateSpan<T>(ref T, int)

    ToSpan<TElement>(ref FixedList4096Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static Span<TElement> ToSpan<TElement>(this ref FixedList4096Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList4096Bytes<TElement> container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    Span<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged element type

    ToSpan<TElement>(ref FixedList512Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged type reference.

    Declaration
    public static Span<TElement> ToSpan<TElement>(this ref FixedList512Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList512Bytes<TElement> container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    Span<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged element type

    ToSpan<TElement>(ref FixedList64Bytes<TElement>, int)

    Creates a new ReadOnlySpan over a portion of a regular unmanaged fixed list reference.

    Declaration
    public static Span<TElement> ToSpan<TElement>(this ref FixedList64Bytes<TElement> container, int length) where TElement : unmanaged
    Parameters
    Type Name Description
    FixedList64Bytes<TElement> container

    The fixed list reference

    int length

    The number of elements

    Returns
    Type Description
    Span<TElement>

    A new ReadOnlySpan starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TElement

    The unmanged argument type

    Remarks

    Use with cautions, because internally uses the CreateSpan<T>(ref T, int)

    ToSpan<TContainer, TElement>(ref TContainer, int)

    Creates a new Span over a portion of a regular unmanaged type reference.

    Declaration
    public static Span<TElement> ToSpan<TContainer, TElement>(ref TContainer container, int length) where TContainer : unmanaged where TElement : unmanaged
    Parameters
    Type Name Description
    TContainer container

    The managed container element reference

    int length

    The number of elements

    Returns
    Type Description
    Span<TElement>

    A new Span starting from the address of the container reference and given length

    Type Parameters
    Name Description
    TContainer

    The unmanged container type

    TElement

    The unmanged element type

    In This Article
    Back to top
    Copyright © 2025 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)