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