Namespace Scylla.Core.Util.Serialization
Classes
ArraySerializer<T>
Type serializer for arrays of type T. Serializes the array as a
JSON array token sequence (start-array, elements, end-array), or as a null token when the
array reference itself is null.
BoolSerializer
Type serializer for the bool primitive. Writes and reads a single boolean token through the active IScyllaWriter / IScyllaReader without additional framing.
BoundsSerializer
Type serializer for UnityEngine.Bounds values (axis-aligned bounding box defined by a
center position and a size). Writes and reads the center and size as nested
UnityEngine.Vector3 JSON objects. Unknown properties encountered during read are
silently skipped.
ByteArraySerializer
Type serializer for byte arrays. Writes the entire array as a single opaque
bytes token, which is typically encoded as a Base64 string in JSON output. Returns
null when the token represents a null literal.
ByteSerializer
Type serializer for the byte primitive (unsigned 8-bit integer, range 0-255). Writes and reads a single byte token without additional framing.
CharSerializer
Type serializer for the char primitive (UTF-16 code unit). Writes and reads a single character token without additional framing. The underlying writer/reader implementation is responsible for encoding the character appropriately (e.g., as a single-character JSON string).
Color32Serializer
Type serializer for UnityEngine.Color32 values (32-bit RGBA with byte components in the
range [0, 255]). Writes and reads the four byte components r, g, b,
and a as a JSON object with named properties. Unknown properties encountered during
read are silently skipped.
ColorSerializer
Type serializer for UnityEngine.Color values (32-bit RGBA with float components in the
range [0, 1]). Writes and reads the four single-precision components r, g,
b, and a as a JSON object with named properties. Unknown properties
encountered during read are silently skipped.
DateTimeOffsetSerializer
Type serializer for DateTimeOffset values. Converts each value to and from
the ISO 8601 round-trip format string ("o"), which preserves both the date-time
instant and the UTC offset, for example 2024-06-15T10:30:00.0000000+02:00.
DateTimeSerializer
Type serializer for DateTime values. Converts each value to and from the
ISO 8601 round-trip format string ("o"), which preserves the DateTimeKind
(Local, Utc, or Unspecified) and full sub-second precision.
DecimalSerializer
Type serializer for the decimal primitive (128-bit high-precision decimal with 28-29 significant digits). Writes and reads a single decimal token without additional framing. Suitable for financial and monetary values where binary floating-point rounding is unacceptable.
DictionarySerializer<TKey, TValue>
Type serializer for Dictionary<TKey, TValue> collections. The serialization format differs based on the key type:
-
When
TKeyis string, the dictionary is written as a JSON object where each key becomes a property name and each value becomes the corresponding property value. -
When
TKeyis any other type, the dictionary is written as a JSON array of{"k": key, "v": value}objects, preserving type fidelity for complex key types.
A null reference is serialized as a null token.
DoubleSerializer
Type serializer for the double primitive (IEEE 754 double-precision floating-point). Writes and reads a single double token without additional framing.
EnumSerializer<T>
Type serializer for enum values of type T.
Serializes enums as their string names for human readability and forward compatibility,
and falls back to integer parsing when deserializing values stored by older code.
FloatSerializer
Type serializer for the float primitive (IEEE 754 single-precision floating-point). Writes and reads a single float token without additional framing. Used extensively by the Unity primitive serializers (e.g., Vector3Serializer) to persist individual components.
GuidSerializer
Type serializer for Guid values. Converts each GUID to and from the
standard hyphenated 8-4-4-4-12 string representation (format specifier "D"),
for example 550e8400-e29b-41d4-a716-446655440000.
HashSetSerializer<T>
Type serializer for HashSet<T> collections. Serializes the set as a JSON
array token sequence (start-array, elements, end-array), or as a null token when the set
reference itself is null. Iteration order follows the set's internal enumerator,
which is unspecified.
IntSerializer
Type serializer for the int primitive (signed 32-bit integer). Writes and reads a single integer token without additional framing. This is the most commonly used numeric serializer in the Scylla serialization system.
LayerMaskSerializer
Type serializer for UnityEngine.LayerMask values. Persists the mask as its underlying 32-bit signed integer bitmask via WriteInt(int), preserving all layer bits exactly.
ListSerializer<T>
Type serializer for List<T> collections. Serializes the list as a JSON array
token sequence (start-array, elements, end-array), or as a null token when the list
reference itself is null.
LongSerializer
Type serializer for the long primitive (signed 64-bit integer). Writes and reads a single long token without additional framing. Also used internally by TimeSpanSerializer to persist TimeSpan as a tick count.
PropertyMetadata
Represents cached reflection metadata for a single serializable property or field belonging to a type managed by the Scylla serialization system.
QuaternionSerializer
Type serializer for UnityEngine.Quaternion values. Writes and reads the four
single-precision floating-point components x, y, z, and w
as a JSON object with named properties. Unknown properties encountered during read are
silently skipped.
QueueSerializer<T>
Type serializer for Queue<T> collections. Serializes the queue as a JSON
array token sequence in FIFO (front-to-back) order, or as a null token when the queue
reference itself is null. On deserialization, elements are enqueued in the order
they appear in the array, preserving FIFO semantics.
RectIntSerializer
Type serializer for UnityEngine.RectInt values (axis-aligned integer rectangle defined
by position and dimensions as 32-bit integers). Writes and reads the x, y,
width, and height components as a JSON object with named properties. Unknown
properties encountered during read are silently skipped.
RectSerializer
Type serializer for UnityEngine.Rect values (axis-aligned rectangle defined by position
and dimensions as floats). Writes and reads the x, y, width, and
height components as a JSON object with named properties. Unknown properties
encountered during read are silently skipped.
ReferenceTracker
Tracks object references during serialization and deserialization to detect cyclic graphs and, optionally, preserve object identity across the serialized representation.
ReflectionSerializer
A general-purpose reflection-based serializer for custom classes and structs. Unlike the
dedicated primitive and Unity-type serializers, ReflectionSerializer handles
arbitrary user-defined types by inspecting their TypeMetadata at runtime -
iterating over discoverable public properties and fields, writing each as a named JSON
property, and reconstructing the object from those properties on read.
SByteSerializer
Type serializer for the sbyte primitive (signed 8-bit integer, range -128-127). Writes and reads a single signed-byte token without additional framing.
ScyllaIgnoreAttribute
Marks a field or property to be excluded from Scylla serialization, regardless of its access modifier or any other serialization settings.
ScyllaIncludeAttribute
Marks a non-public field or property to be included in Scylla serialization, overriding the default behavior that limits serialization to public members.
ScyllaJSONReader
JSON format implementation of IScyllaReader that parses a JSON string in a forward-only, token-by-token fashion without allocating intermediate DOM nodes. Provides structured access to all JSON value types, object properties, and arrays.
ScyllaJSONWriter
JSON format implementation of IScyllaWriter that serializes values into valid JSON text using an internal StringBuilder for efficient string accumulation. Supports optional pretty-printing with configurable indentation.
ScyllaMigrationAttribute
Marks a static method as a schema migration handler that upgrades serialized data from one schema version to another during deserialization.
ScyllaPropertyAttribute
Specifies custom serialization behavior for an individual field or property, including a custom output name, serialization ordering, and required-value enforcement.
ScyllaSerializableAttribute
Marks a class or struct as explicitly versioned by the Scylla serialization system, enabling schema migration support and optional type aliasing for polymorphic deserialization.
ScyllaSerialization
Static facade providing the main public entry point for the Scylla serialization system. Exposes thread-safe methods for serializing and deserializing objects to and from JSON and binary formats, registering custom type serializers, and managing schema migrations.
SerializationContext
Default implementation of ISerializationContext created internally by ScyllaSerialization for each top-level serialization or deserialization call.
SerializationEngine
Internal serialization engine that manages the global type-serializer registry, dispatches read and write operations to the correct ITypeSerializer, and creates serializers on demand for types that do not have one pre-registered.
SerializationException
Exception thrown when a serialization or deserialization operation performed by the Scylla serialization engine fails in a way that prevents the operation from completing successfully.
SerializationSettings
Immutable configuration object that controls every aspect of a Scylla serialization or deserialization operation. Settings instances are created via the fluent SerializationSettings.Builder API obtained from CreateBuilder() or ToBuilder().
SerializationSettings.Builder
Fluent builder for constructing immutable SerializationSettings
instances. Each With* method returns the same builder to enable method
chaining. Call Build() when all options have been configured.
ShortSerializer
Type serializer for the short primitive (signed 16-bit integer, range -32,768-32,767). Writes and reads a single short token without additional framing.
StackSerializer<T>
Type serializer for Stack<T> collections. Serializes the stack as a JSON array with elements in their push order (top-of-stack first), then restores the original stack ordering on deserialization. A null reference is serialized as a null token.
StringSerializer
Type serializer for the string type. Writes and reads a single string token
without additional framing. null string values are passed directly to the writer;
the writer implementation is responsible for emitting a null token.
TimeSpanSerializer
Type serializer for TimeSpan values. Persists the duration as a raw 64-bit tick count (100-nanosecond intervals) via WriteLong(long), guaranteeing lossless round-trip precision for any representable TimeSpan.
TypeMetadata
Represents all reflection metadata required to serialize and deserialize a single C# type within the Scylla serialization system.
TypeMetadataCache
A global, thread-safe cache that stores TypeMetadata instances indexed by Type, and maintains a reverse mapping from type-alias strings to their corresponding runtime types.
TypeSerializerAdapter<T>
Adapter that wraps a strongly-typed ITypeSerializer<T> as the non-generic ITypeSerializer interface, enabling it to be stored and invoked through the engine's runtime type-keyed registry without requiring generic type arguments at the call site.
TypeSerializerBase<T>
Abstract base class for strongly-typed serializers, implementing the bridge between the generic ITypeSerializer<T> contract and the non-generic ITypeSerializer contract required for runtime type dispatch.
UIntSerializer
Type serializer for the uint primitive (unsigned 32-bit integer, range 0-4,294,967,295). Writes and reads a single unsigned integer token without additional framing.
ULongSerializer
Type serializer for the ulong primitive (unsigned 64-bit integer, range 0-18,446,744,073,709,551,615). Writes and reads a single unsigned long token without additional framing.
UShortSerializer
Type serializer for the ushort primitive (unsigned 16-bit integer, range 0-65,535). Writes and reads a single unsigned-short token without additional framing.
Vector2IntSerializer
Type serializer for UnityEngine.Vector2Int values. Writes and reads the two 32-bit
integer components x and y as a JSON object with named properties. Unknown
properties encountered during read are silently skipped.
Vector2Serializer
Type serializer for UnityEngine.Vector2 values. Writes and reads the two single-precision
components x and y as a JSON object with named properties. Unknown properties
encountered during read are silently skipped via Skip().
Vector3IntSerializer
Type serializer for UnityEngine.Vector3Int values. Writes and reads the three 32-bit
integer components x, y, and z as a JSON object with named properties.
Unknown properties encountered during read are silently skipped.
Vector3Serializer
Type serializer for UnityEngine.Vector3 values. Writes and reads the three
single-precision floating-point components x, y, and z as a JSON
object with named properties. This serializer is also used internally by
BoundsSerializer to persist the center and size vectors. Unknown properties
encountered during read are silently skipped.
Vector4Serializer
Type serializer for UnityEngine.Vector4 values. Writes and reads the four
single-precision floating-point components x, y, z, and w
as a JSON object with named properties. Unknown properties encountered during read are
silently skipped.
Structs
SerializationResult
Represents the outcome of a serialization or deserialization operation that does not produce a return value (for example, serializing directly to a stream). Carries either a success flag or an error message and optional exception, without any associated payload.
SerializationResult<T>
Represents the outcome of a serialization or deserialization operation that produces
a value of type T. Carries either the successful result value
or an error message and optional exception.
Interfaces
IScyllaReader
Low-level, format-agnostic interface for reading serialized data in a forward-only, token-by-token fashion. Implementations decode a specific wire format (such as JSON) and expose its content through a uniform API that the serialization engine can consume without knowing the underlying representation.
IScyllaWriter
Low-level, format-agnostic interface for writing serialized data in a sequential, value-by-value fashion. Implementations encode values into a specific wire format (such as JSON) so that the serialization engine can produce output without being coupled to the underlying representation.
ISerializationContext
Provides stateful context information threaded through a single serialization or deserialization operation. Each top-level call to ScyllaSerialization creates a fresh context that is passed down to every ITypeSerializer and ITypeSerializer<T> involved in the operation.
ITypeSerializer
Non-generic base interface for type serializers used by the Scylla serialization engine for runtime type resolution and registration.
ITypeSerializer<T>
Generic interface for custom type serialization handlers. Implement this interface
to provide complete, type-safe control over how a specific type T
is written to and read from a Scylla serialization format.
Enums
DefaultValueHandling
Specifies how fields and properties whose current value equals the type's default
value (e.g., 0 for numeric types, false for booleans, null for
reference types) are treated during serialization.
NullHandling
Specifies how null values for reference-type fields and properties are
treated when an object is serialized.
ReferenceHandling
Specifies how the serialization engine responds when it encounters the same object reference more than once while traversing an object graph, which may indicate either a legitimate shared reference or a circular reference (cycle).
SerializationFormat
Specifies the output encoding format produced by a serialization operation and expected by the corresponding deserialization operation.
SerializationToken
Identifies the kind of value or structural delimiter at the current read position in a serialized data stream. Used by PeekToken() to allow callers to branch on the incoming token type before consuming it.