docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct SerializedPrimitiveView

    A view on top of the PackedBinaryStream that represents any unquoted value.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Serialization.Json
    Assembly: Unity.Serialization.dll
    Syntax
    public readonly struct SerializedPrimitiveView

    Methods

    AsBoolean()

    Reinterprets the primitive as a bool.

    Declaration
    public bool AsBoolean()
    Returns
    Type Description
    bool

    The primitive as a bool.

    Exceptions
    Type Condition
    ParseErrorException

    The parser failed to convert the characters.

    AsDouble()

    Reinterprets the primitive as a double.

    Declaration
    public double AsDouble()
    Returns
    Type Description
    double

    The primitive as a double.

    Remarks

    This method relies on a string allocation for Parse(string).

    AsFixedString<T>()

    Returns the value as a string.

    Declaration
    public T AsFixedString<T>() where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Returns
    Type Description
    T

    The value as a string.

    Type Parameters
    Name Description
    T

    The fixed string type.

    AsFloat()

    Reinterprets the primitive as a float.

    Declaration
    public float AsFloat()
    Returns
    Type Description
    float

    The primitive as a float.

    Exceptions
    Type Condition
    ParseErrorException

    The parser failed to convert the characters.

    AsInt64()

    Reinterprets the primitive as a long.

    Declaration
    public long AsInt64()
    Returns
    Type Description
    long

    The primitive as a long.

    Exceptions
    Type Condition
    ParseErrorException

    The parser failed to convert the characters.

    AsNativeText(Allocator)

    Returns the value as a string.

    Declaration
    public NativeText AsNativeText(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocator to use for the text.

    Returns
    Type Description
    NativeText

    The value as a string.

    AsString()

    Allocates and returns a new string for the primitive.

    Declaration
    public string AsString()
    Returns
    Type Description
    string

    A string copy of the primitive.

    AsStringView()

    Returns a string view over the primitive.

    Declaration
    public SerializedStringView AsStringView()
    Returns
    Type Description
    SerializedStringView

    A SerializedStringView over this primitive.

    AsUInt64()

    Reinterprets the primitive as a ulong.

    Declaration
    public ulong AsUInt64()
    Returns
    Type Description
    ulong

    The primitive as a ulong.

    Exceptions
    Type Condition
    ParseErrorException

    The parser failed to convert the characters.

    AsUnsafeText(Allocator)

    Returns the value as a string.

    Declaration
    public UnsafeText AsUnsafeText(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    The allocator to use for the text.

    Returns
    Type Description
    UnsafeText

    The value as a string.

    IsBoolean()

    Returns true if the primitive is a boolean type.

    Declaration
    public bool IsBoolean()
    Returns
    Type Description
    bool

    True if this primitive is an boolean type; false otherwise.

    IsDecimal()

    Returns true if the primitive is a decimal type.

    Declaration
    public bool IsDecimal()
    Returns
    Type Description
    bool

    True if this primitive is an decimal type; false otherwise.

    IsInfinity()

    Returns true if the primitive represents infinity.

    Declaration
    public bool IsInfinity()
    Returns
    Type Description
    bool

    True if this primitive is infinity; false otherwise.

    IsIntegral()

    Returns true if the primitive is an integral type.

    Declaration
    public bool IsIntegral()
    Returns
    Type Description
    bool

    True if this primitive is an integral type; false otherwise.

    IsNaN()

    Returns true if the primitive represents a value that is not a number.

    Declaration
    public bool IsNaN()
    Returns
    Type Description
    bool

    True if this primitive is nan; false otherwise.

    IsNull()

    Returns true if the primitive represents a value that is null.

    Declaration
    public bool IsNull()
    Returns
    Type Description
    bool

    True if this primitive is null; false otherwise.

    IsSigned()

    Returns true if the primitive is a signed type.

    Declaration
    public bool IsSigned()
    Returns
    Type Description
    bool

    True if this primitive is an signed type; false otherwise.

    ToString()

    Returns the value as a string.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    The value as a string.

    Overrides
    ValueType.ToString()
    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)