docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct BinaryParser

    Ref struct to hide unsafe pointer logic

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Logging
    Assembly: Unity.Logging.dll
    Syntax
    public readonly ref struct BinaryParser

    Constructors

    BinaryParser(void*, int)

    Creates the ref struct

    Declaration
    public BinaryParser(void* ptrContextData, int payloadBufferLength)
    Parameters
    Type Name Description
    void* ptrContextData

    Pointer to the data

    int payloadBufferLength

    Length of the data in bytes

    Fields

    LengthInBytes

    Length of the data in bytes

    Declaration
    public readonly int LengthInBytes
    Field Value
    Type Description
    int

    Properties

    IsValid

    True if Pointer is not null and length is bigger than 0

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    bool

    Pointer

    Safe IntPtr wrapper for the internal pointer

    Declaration
    public IntPtr Pointer { get; }
    Property Value
    Type Description
    IntPtr

    Methods

    AppendToUnsafeText<T>(ref UnsafeText, ref FormatterStruct, ref LogMemoryManager, ref ArgumentInfo)

    Reads the pointer as T that implements ILoggableMirrorStruct, and appends it to the UnsafeText. Checks out of bound read if debug checks are present

    Declaration
    public bool AppendToUnsafeText<T>(ref UnsafeText hstring, ref FormatterStruct formatter, ref LogMemoryManager memAllocator, ref ArgumentInfo currArgSlot) where T : unmanaged, ILoggableMirrorStruct
    Parameters
    Type Name Description
    UnsafeText hstring

    UnsafeText where to append

    FormatterStruct formatter

    Current formatter

    LogMemoryManager memAllocator

    Memory manager that holds binary representation of the mirror struct

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or or {Number:##.0;-##.0}

    Returns
    Type Description
    bool

    True if append was successful

    Type Parameters
    Name Description
    T

    Unmanaged struct that implements ILoggableMirrorStruct

    AppendUTF8StringToUnsafeText(ref UnsafeText, ref FormatterStruct, int, ref ArgumentInfo)

    Reads the pointer as a UTF8 string and appends it to the UnsafeText. Checks out of bound read if debug checks are present

    Declaration
    public bool AppendUTF8StringToUnsafeText(ref UnsafeText hstring, ref FormatterStruct formatter, int stringLengthInBytes, ref ArgumentInfo currArgSlot)
    Parameters
    Type Name Description
    UnsafeText hstring

    UnsafeText where to append

    FormatterStruct formatter

    Current formatter

    int stringLengthInBytes

    Length of the UTF8 string in bytes

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or or {Number:##.0;-##.0}

    Returns
    Type Description
    bool

    True if append was successful

    Peek<T>()

    Reads the pointer as T. Checks out of bound read if debug checks are present

    Declaration
    public T Peek<T>() where T : unmanaged
    Returns
    Type Description
    T

    T representation of binary data under Ptr

    Type Parameters
    Name Description
    T

    Unmanaged type

    Skip(int)

    Creates new BinaryParser that is a slice of the current one, but 'bytes' are skipped

    Declaration
    public BinaryParser Skip(int bytes)
    Parameters
    Type Name Description
    int bytes

    Bytes to skip

    Returns
    Type Description
    BinaryParser

    Slice of the current BinaryParser

    Skip<T>()

    Creates new BinaryParser that is a slice of the current one, but SizeOf are skipped

    Declaration
    public BinaryParser Skip<T>() where T : unmanaged
    Returns
    Type Description
    BinaryParser

    Slice of the current BinaryParser

    Type Parameters
    Name Description
    T

    Unmanaged type, its size will be used to skip

    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)