Table of Contents

Class RawStringSyncSerializer

Namespace
SteamNetworkLib.Sync
Assembly
SteamNetworkLib.dll

Sync serializer that passes string values through without JSON encoding.

public sealed class RawStringSyncSerializer : ISyncSerializer
Inheritance
RawStringSyncSerializer
Implements
Inherited Members

Remarks

Use this for pre-serialized payloads, pipe-delimited state, compact protocol strings, or compatibility data that must match another mod's existing lobby-data format. Non-empty strings are stored verbatim. Steam lobby and member data use an empty string for missing keys, so an empty or null value follows the SyncVar's missing-value behavior and resolves to its configured default on other peers. It only supports string values; use JsonSyncSerializer for typed objects, primitives, collections, and general-purpose SyncVars.

Constructors

RawStringSyncSerializer()

public RawStringSyncSerializer()

Methods

CanSerialize(Type)

Checks if a type can be serialized by this serializer.

public bool CanSerialize(Type type)

Parameters

type Type

The type to check.

Returns

bool

True if the type can be serialized; otherwise, false.

Remarks

This method is called during HostSyncVar<T> and ClientSyncVar<T> creation to validate that the type parameter is serializable.

Deserialize<T>(string)

Deserializes a string back to the original value type.

public T Deserialize<T>(string data)

Parameters

data string

The serialized string data.

Returns

T

The deserialized value.

Type Parameters

T

The type to deserialize to.

Exceptions

SyncSerializationException

Thrown when deserialization fails.

Serialize<T>(T)

Serializes a value to a string for network transmission.

public string Serialize<T>(T value)

Parameters

value T

The value to serialize.

Returns

string

A string representation of the value.

Type Parameters

T

The type of value to serialize.

Exceptions

SyncSerializationException

Thrown when serialization fails.