docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method WriteValueSafe

    WriteValueSafe(string, bool)

    Writes a string

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

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

    The string to write

    bool oneByteChars

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

    WriteValueSafe<T>(in T, ForNetworkSerializable)

    Write a NetworkSerializable value

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

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

    The value to write

    FastBufferWriter.ForNetworkSerializable unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(T[], ForNetworkSerializable)

    Write a NetworkSerializable array

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

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

    The values to write

    FastBufferWriter.ForNetworkSerializable unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(in T, ForStructs)

    Write a struct

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

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

    The value to write

    FastBufferWriter.ForStructs unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(T[], ForStructs)

    Write a struct array

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

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

    The values to write

    FastBufferWriter.ForStructs unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(NativeArray<T>, ForGeneric)

    Write a struct NativeArray

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

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

    The values to write

    FastBufferWriter.ForGeneric unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(in T, ForPrimitives)

    Write 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 writes at once by calling TryBeginWrite.

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

    The value to write

    FastBufferWriter.ForPrimitives unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(T[], ForPrimitives)

    Write 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 writes at once by calling TryBeginWrite.

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

    The value to write

    FastBufferWriter.ForPrimitives unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(in T, ForEnums)

    Write an enum value

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

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

    The value to write

    FastBufferWriter.ForEnums unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(T[], ForEnums)

    Write an enum array

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

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

    The values to write

    FastBufferWriter.ForEnums unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe(in Vector2)

    Write a Vector2

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

    Declaration
    public void WriteValueSafe(in Vector2 value)
    Parameters
    Type Name Description
    Vector2 value

    the value to write

    WriteValueSafe(Vector2[])

    Write a Vector2 array

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

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

    the values to write

    WriteValueSafe(in Vector3)

    Write a Vector3

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

    Declaration
    public void WriteValueSafe(in Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    the value to write

    WriteValueSafe(Vector3[])

    Write a Vector3 array

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

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

    the values to write

    WriteValueSafe(in Vector2Int)

    Write a Vector2Int

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

    Declaration
    public void WriteValueSafe(in Vector2Int value)
    Parameters
    Type Name Description
    Vector2Int value

    the value to write

    WriteValueSafe(Vector2Int[])

    Write a Vector2Int array

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

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

    the values to write

    WriteValueSafe(in Vector3Int)

    Write a Vector3Int

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

    Declaration
    public void WriteValueSafe(in Vector3Int value)
    Parameters
    Type Name Description
    Vector3Int value

    the value to write

    WriteValueSafe(Vector3Int[])

    Write a Vector3Int array

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

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

    the values to write

    WriteValueSafe(in Vector4)

    Write a Vector4

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

    Declaration
    public void WriteValueSafe(in Vector4 value)
    Parameters
    Type Name Description
    Vector4 value

    the value to write

    WriteValueSafe(Vector4[])

    Write a Vector4 array

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

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

    the values to write

    WriteValueSafe(in Quaternion)

    Write a Quaternion

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

    Declaration
    public void WriteValueSafe(in Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    the value to write

    WriteValueSafe(Quaternion[])

    Write a Quaternion array

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

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

    the values to write

    WriteValueSafe(in Color)

    Write a Color

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

    Declaration
    public void WriteValueSafe(in Color value)
    Parameters
    Type Name Description
    Color value

    the value to write

    WriteValueSafe(Color[])

    Write a Collor array

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

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

    the values to write

    WriteValueSafe(in Color32)

    Write a Color32

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

    Declaration
    public void WriteValueSafe(in Color32 value)
    Parameters
    Type Name Description
    Color32 value

    the value to write

    WriteValueSafe(Color32[])

    Write a Color32 array

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

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

    the values to write

    WriteValueSafe(in Ray)

    Write a Ray

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

    Declaration
    public void WriteValueSafe(in Ray value)
    Parameters
    Type Name Description
    Ray value

    the value to write

    WriteValueSafe(Ray[])

    Write a Ray array

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

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

    the values to write

    WriteValueSafe(in Ray2D)

    Write a Ray2D

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

    Declaration
    public void WriteValueSafe(in Ray2D value)
    Parameters
    Type Name Description
    Ray2D value

    the value to write

    WriteValueSafe(Ray2D[])

    Write a Ray2D array

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

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

    the values to write

    WriteValueSafe<T>(in T, ForFixedStrings)

    Write a FixedString value. Writes only the part of the string that's actually used.

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

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

    the value to write

    FastBufferWriter.ForFixedStrings unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(T[], ForFixedStrings)

    Write a NativeArray of FixedString values. Writes only the part of each string that's actually used. "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple writes at once by calling TryBeginWrite.

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

    the value to write

    FastBufferWriter.ForFixedStrings unused

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

    Type Parameters
    Name Description
    T

    The type being serialized

    WriteValueSafe<T>(in NativeArray<T>)

    Write a NativeArray of FixedString values. Writes only the part of each string that's actually used. "Safe" version - automatically performs bounds checking. Less efficient than bounds checking for multiple writes at once by calling TryBeginWrite.

    Declaration
    public void WriteValueSafe<T>(in NativeArray<T> value) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    NativeArray<T> value

    the value to write

    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)