Class 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.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class BoundsSerializer : TypeSerializerBase<Bounds>, ITypeSerializer<Bounds>, ITypeSerializer
Remarks
The serialized JSON format is:
<pre><code class="lang-csharp">{
"center": { "x": float, "y": float, "z": float },
"size": { "x": float, "y": float, "z": float }
}
Both nested objects are serialized by delegating to <xref href="Scylla.Core.Util.Serialization.Vector3Serializer.Instance" data-throw-if-not-resolved="false"></xref>.
Missing <code>center</code> or <code>size</code> properties default to <xref href="UnityEngine.Vector3.zero" data-throw-if-not-resolved="false"></xref>
on deserialization.
Use the shared Instance singleton rather than creating new instances;
BoundsSerializer carries no mutable state and is safe to share across threads.
Fields
Instance
Shared, reusable singleton instance of BoundsSerializer.
Prefer this over allocating a new instance wherever a BoundsSerializer is needed.
Declaration
public static readonly BoundsSerializer Instance
Field Value
| Type | Description |
|---|---|
| BoundsSerializer |
Methods
Read(IScyllaReader, ISerializationContext)
Reads a UnityEngine.Bounds from the reader, populating center and size
by delegating to Instance.
Declaration
public override Bounds 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 |
|---|---|
| Bounds | The deserialized UnityEngine.Bounds. Missing |
Overrides
Write(Bounds, IScyllaWriter, ISerializationContext)
Writes a UnityEngine.Bounds to the output as a JSON object with nested center
and size UnityEngine.Vector3 objects, delegating component serialization to
Instance.
Declaration
public override void Write(Bounds value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| Bounds | value | The UnityEngine.Bounds to serialize. |
| IScyllaWriter | writer | The writer that receives the serialized output. Never |
| ISerializationContext | context | The active serialization context. Never |