docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BinaryReaderExtensions

    Extension methods that add typed read helpers to BinaryReader for common Unity value types.

    Inheritance
    object
    BinaryReaderExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.SimulationPro.Foundation
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    public static class BinaryReaderExtensions

    Methods

    ReadBounds(BinaryReader)

    Reads a Bounds from the stream (center Vector3 followed by size Vector3).

    Declaration
    public static Bounds ReadBounds(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Bounds

    The deserialized Bounds.

    ReadColor(BinaryReader)

    Reads a Color from the stream (four consecutive float values: r, g, b, a).

    Declaration
    public static Color ReadColor(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Color

    The deserialized Color.

    ReadColor32(BinaryReader)

    Reads a Color32 from the stream (four consecutive byte values: r, g, b, a).

    Declaration
    public static Color32 ReadColor32(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Color32

    The deserialized Color32.

    ReadQuaternion(BinaryReader)

    Reads a Quaternion from the stream (four consecutive float values: x, y, z, w).

    Declaration
    public static Quaternion ReadQuaternion(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Quaternion

    The deserialized Quaternion.

    ReadVector2(BinaryReader)

    Reads a Vector2 from the stream (two consecutive float values: x, y).

    Declaration
    public static Vector2 ReadVector2(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Vector2

    The deserialized Vector2.

    ReadVector2Int(BinaryReader)

    Reads a Vector2Int from the stream (two consecutive int values: x, y).

    Declaration
    public static Vector2Int ReadVector2Int(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Vector2Int

    The deserialized Vector2Int.

    ReadVector3(BinaryReader)

    Reads a Vector3 from the stream (three consecutive float values: x, y, z).

    Declaration
    public static Vector3 ReadVector3(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Vector3

    The deserialized Vector3.

    ReadVector4(BinaryReader)

    Reads a Vector4 from the stream (four consecutive float values: x, y, z, w).

    Declaration
    public static Vector4 ReadVector4(this BinaryReader reader)
    Parameters
    Type Name Description
    BinaryReader reader

    The binary reader to read from.

    Returns
    Type Description
    Vector4

    The deserialized Vector4.

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