docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct SerializedStringView

    A view on top of the PackedBinaryStream that represents a string.

    Implements
    IEquatable<string>
    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 SerializedStringView : IEquatable<string>

    Properties

    this[int]

    Gets the char at a specified position in the current SerializedStringView.

    Declaration
    public char this[int index] { get; }
    Parameters
    Type Name Description
    int index

    A position in the current string.

    Property Value
    Type Description
    char
    Exceptions
    Type Condition
    IndexOutOfRangeException

    index is greater than or equal to the length of this object or less than zero.

    Methods

    AsFixedString<T>()

    Allocates and returns a new FixedString instance based on the view.

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

    A new Unity.Collections.FixedString instance.

    Type Parameters
    Name Description
    T

    The fixed string type.

    AsNativeText(Allocator)

    Allocates and returns a new Unity.Collections.NativeText instance based on the view.

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

    The allocator to use for the text.

    Returns
    Type Description
    NativeText

    A new Unity.Collections.NativeText instance.

    AsUnsafeText(Allocator)

    Allocates and returns a new Unity.Collections.LowLevel.Unsafe.UnsafeText instance based on the view.

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

    The allocator to use for the text.

    Returns
    Type Description
    UnsafeText

    A new Unity.Collections.LowLevel.Unsafe.UnsafeText instance.

    Equals(string)

    Determines whether this view and another specified string object have the same value.

    Declaration
    public bool Equals(string other)
    Parameters
    Type Name Description
    string other

    The string to compare to this view.

    Returns
    Type Description
    bool

    true if the value of the value parameter is the same as the value of this view; otherwise, false.

    Equals<T>(T)

    Determines whether this view and another specified string object have the same value.

    Declaration
    public bool Equals<T>(T other) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    T other

    The string to compare to this view.

    Returns
    Type Description
    bool

    true if the value of the value parameter is the same as the value of this view; otherwise, false.

    Type Parameters
    Name Description
    T

    The fixed string type.

    Length()

    Gets the number of characters in the SerializedStringView.

    Declaration
    public int Length()
    Returns
    Type Description
    int

    The number of characters in the string.

    ToString()

    Allocates and returns a new string instance based on the view.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A new string instance.

    Overrides
    ValueType.ToString()

    Implements

    IEquatable<T>
    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)