Class 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.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class Vector3Serializer : TypeSerializerBase<Vector3>, ITypeSerializer<Vector3>, ITypeSerializer
Remarks
The serialized JSON format is {"x": float, "y": float, "z": float}. Missing
component properties default to 0 on deserialization.
Use the shared Instance singleton rather than creating new instances;
Vector3Serializer carries no mutable state and is safe to share across threads.
Fields
Instance
Shared, reusable singleton instance of Vector3Serializer.
Prefer this over allocating a new instance wherever a Vector3Serializer is needed.
Declaration
public static readonly Vector3Serializer Instance
Field Value
| Type | Description |
|---|---|
| Vector3Serializer |
Methods
Read(IScyllaReader, ISerializationContext)
Reads a UnityEngine.Vector3 from the reader, populating components from a JSON
object's x, y, and z properties.
Declaration
public override Vector3 Read(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The reader positioned at the start of a JSON object. Never |
| ISerializationContext | context | The active serialization context. Never |
Returns
| Type | Description |
|---|---|
| Vector3 | The deserialized UnityEngine.Vector3. Any missing component defaults to |
Overrides
Write(Vector3, IScyllaWriter, ISerializationContext)
Writes a UnityEngine.Vector3 to the output as a JSON object containing the
x, y, and z float components.
Declaration
public override void Write(Vector3 value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | value | The UnityEngine.Vector3 to serialize. |
| IScyllaWriter | writer | The writer that receives the serialized output. Never |
| ISerializationContext | context | The active serialization context. Never |