docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method ReadValueSafe

    ReadValueSafe(out string, bool)

    Reads a string. NOTE: ALLOCATES

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out string s, bool oneByteChars = false)
    Parameters
    Type Name Description
    string s

    Stores the read string

    bool oneByteChars

    Whether or not to use one byte per character. This will only allow ASCII

    ReadValueSafe<T>(out T, ForNetworkSerializable)

    Read a NetworkSerializable value

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T value, FastBufferWriter.ForNetworkSerializable unused = default) where T : INetworkSerializable, new()
    Parameters
    Type Name Description
    T value

    The value to read

    FastBufferWriter.ForNetworkSerializable unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T[], ForNetworkSerializable)

    Read a NetworkSerializable array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T[] value, FastBufferWriter.ForNetworkSerializable unused = default) where T : INetworkSerializable, new()
    Parameters
    Type Name Description
    T[] value

    The values to read

    FastBufferWriter.ForNetworkSerializable unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out NativeArray<T>, Allocator, ForNetworkSerializable)

    Read a NetworkSerializable NativeArray

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out NativeArray<T> value, Allocator allocator, FastBufferWriter.ForNetworkSerializable unused = default) where T : unmanaged, INetworkSerializable
    Parameters
    Type Name Description
    NativeArray<T> value

    The values to read

    Allocator allocator

    The allocator to use to construct the resulting NativeArray

    FastBufferWriter.ForNetworkSerializable unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T, ForStructs)

    Read a struct

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T value, FastBufferWriter.ForStructs unused = default) where T : unmanaged, INetworkSerializeByMemcpy
    Parameters
    Type Name Description
    T value

    The value to read

    FastBufferWriter.ForStructs unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T[], ForStructs)

    Read a struct array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T[] value, FastBufferWriter.ForStructs unused = default) where T : unmanaged, INetworkSerializeByMemcpy
    Parameters
    Type Name Description
    T[] value

    The values to read

    FastBufferWriter.ForStructs unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out NativeArray<T>, Allocator, ForGeneric)

    Read a struct NativeArray

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out NativeArray<T> value, Allocator allocator, FastBufferWriter.ForGeneric unused = default) where T : unmanaged
    Parameters
    Type Name Description
    NativeArray<T> value

    The values to read

    Allocator allocator

    The allocator to use to construct the resulting NativeArray

    FastBufferWriter.ForGeneric unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T, ForPrimitives)

    Read a primitive value (int, bool, etc) Accepts any value that implements the given interfaces, but is not guaranteed to work correctly on values that are not primitives.

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T value, FastBufferWriter.ForPrimitives unused = default) where T : unmanaged, IComparable, IConvertible, IComparable<T>, IEquatable<T>
    Parameters
    Type Name Description
    T value

    The value to read

    FastBufferWriter.ForPrimitives unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T[], ForPrimitives)

    Read a primitive value (int, bool, etc) array Accepts any value that implements the given interfaces, but is not guaranteed to work correctly on values that are not primitives.

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T[] value, FastBufferWriter.ForPrimitives unused = default) where T : unmanaged, IComparable, IConvertible, IComparable<T>, IEquatable<T>
    Parameters
    Type Name Description
    T[] value

    The value to read

    FastBufferWriter.ForPrimitives unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T, ForEnums)

    Read an enum value

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T value, FastBufferWriter.ForEnums unused = default) where T : unmanaged, Enum
    Parameters
    Type Name Description
    T value

    The value to read

    FastBufferWriter.ForEnums unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T[], ForEnums)

    Read an enum array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T[] value, FastBufferWriter.ForEnums unused = default) where T : unmanaged, Enum
    Parameters
    Type Name Description
    T[] value

    The values to read

    FastBufferWriter.ForEnums unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe(out Vector2)

    Read a Vector2

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector2 value)
    Parameters
    Type Name Description
    Vector2 value

    the value to read

    ReadValueSafe(out Vector2[])

    Read a Vector2 array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector2[] value)
    Parameters
    Type Name Description
    Vector2[] value

    the values to read

    ReadValueSafe(out Vector3)

    Read a Vector3

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    the value to read

    ReadValueSafe(out Vector3[])

    Read a Vector3 array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector3[] value)
    Parameters
    Type Name Description
    Vector3[] value

    the values to read

    ReadValueSafe(out Vector2Int)

    Read a Vector2Int

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector2Int value)
    Parameters
    Type Name Description
    Vector2Int value

    the value to read

    ReadValueSafe(out Vector2Int[])

    Read a Vector2Int array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector2Int[] value)
    Parameters
    Type Name Description
    Vector2Int[] value

    the values to read

    ReadValueSafe(out Vector3Int)

    Read a Vector3Int

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector3Int value)
    Parameters
    Type Name Description
    Vector3Int value

    the value to read

    ReadValueSafe(out Vector3Int[])

    Read a Vector3Int array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector3Int[] value)
    Parameters
    Type Name Description
    Vector3Int[] value

    the values to read

    ReadValueSafe(out Vector4)

    Read a Vector4

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector4 value)
    Parameters
    Type Name Description
    Vector4 value

    the value to read

    ReadValueSafe(out Vector4[])

    Read a Vector4 array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Vector4[] value)
    Parameters
    Type Name Description
    Vector4[] value

    the values to read

    ReadValueSafe(out Quaternion)

    Read a Quaternion

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    the value to read

    ReadValueSafe(out Quaternion[])

    Read a Quaternion array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Quaternion[] value)
    Parameters
    Type Name Description
    Quaternion[] value

    the values to read

    ReadValueSafe(out Color)

    Read a Color

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Color value)
    Parameters
    Type Name Description
    Color value

    the value to read

    ReadValueSafe(out Color[])

    Read a Collor array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Color[] value)
    Parameters
    Type Name Description
    Color[] value

    the values to read

    ReadValueSafe(out Color32)

    Read a Color32

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Color32 value)
    Parameters
    Type Name Description
    Color32 value

    the value to read

    ReadValueSafe(out Color32[])

    Read a Color32 array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Color32[] value)
    Parameters
    Type Name Description
    Color32[] value

    the values to read

    ReadValueSafe(out Ray)

    Read a Ray

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Ray value)
    Parameters
    Type Name Description
    Ray value

    the value to read

    ReadValueSafe(out Ray[])

    Read a Ray array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Ray[] value)
    Parameters
    Type Name Description
    Ray[] value

    the values to read

    ReadValueSafe(out Ray2D)

    Read a Ray2D

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Ray2D value)
    Parameters
    Type Name Description
    Ray2D value

    the value to read

    ReadValueSafe(out Ray2D[])

    Read a Ray2D array

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe(out Ray2D[] value)
    Parameters
    Type Name Description
    Ray2D[] value

    the values to read

    ReadValueSafe<T>(out T, ForFixedStrings)

    Read a FixedString value.

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T value, FastBufferWriter.ForFixedStrings unused = default) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    T value

    the value to read

    FastBufferWriter.ForFixedStrings unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out NativeArray<T>, Allocator)

    Read a FixedString NativeArray.

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out NativeArray<T> value, Allocator allocator) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    NativeArray<T> value

    the value to read

    Allocator allocator

    The allocator to use to construct the resulting NativeArray

    Type Parameters
    Name Description
    T

    The type being serialized

    ReadValueSafe<T>(out T[], ForFixedStrings)

    Read a FixedString NativeArray using a Temp allocator. Equivalent to ReadValueSafe(out value, Allocator.Temp)

    "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple reads at once by calling TryBeginRead.

    Declaration
    public void ReadValueSafe<T>(out T[] value, FastBufferWriter.ForFixedStrings unused = default) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    T[] value

    the value to read

    FastBufferWriter.ForFixedStrings unused

    An unused parameter used for enabling overload resolution based on generic constraints

    Type Parameters
    Name Description
    T

    The type being serialized

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