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