Class 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.
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public sealed class FloatSerializer : TypeSerializerBase<float>, ITypeSerializer<float>, ITypeSerializer
Remarks
Use the shared Instance singleton rather than creating new instances;
FloatSerializer carries no mutable state and is safe to share across threads.
Fields
Instance
Shared, reusable singleton instance of FloatSerializer.
Prefer this over allocating a new instance wherever a FloatSerializer is needed.
Declaration
public static readonly FloatSerializer Instance
Field Value
| Type | Description |
|---|---|
| FloatSerializer |
Methods
Read(IScyllaReader, ISerializationContext)
Reads a single-precision floating-point value from the reader via ReadFloat().
Declaration
public override float Read(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The reader positioned at a float token. Never |
| ISerializationContext | context | The active serialization context. Never |
Returns
| Type | Description |
|---|---|
| float | The deserialized float value. |
Overrides
Write(float, IScyllaWriter, ISerializationContext)
Writes a single-precision floating-point value to the output via WriteFloat(float).
Declaration
public override void Write(float value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The float value to serialize, including special values such as NaN, PositiveInfinity, and NegativeInfinity; the writer implementation determines how these are represented in the output format. |
| IScyllaWriter | writer | The writer that receives the serialized token. Never |
| ISerializationContext | context | The active serialization context. Never |