Serialization
Definition
Namespace: Brine2D.ECS
| Classes | |
|---|---|
| AotEntitySerializer | AOT-compatible serializer for entity worlds. Functionally equivalent to EntitySerializer but backed by an explicit ComponentTypeRegistry instead of runtime AppDomain scanning, eliminating all reflection in the hot path. |
| Brine2DSnapshotContext | Source-generated System.Text.Json.Serialization.JsonSerializerContext for the built-in snapshot types. Covers WorldSnapshot and EntitySnapshot \(and their constituent collections\) without any runtime reflection, making snapshot-level serialization fully compatible with NativeAOT and IL trimming. |
| ComponentTypeRegistry | Registry that maps component types to their serialization delegates for use with AotEntitySerializer. Register each component type once at startup; AotEntitySerializer will use the registered delegates for every serialize/deserialize/attach operation. |
| EntitySerializer | Serializes and deserializes entities to/from JSON. Uses System.Text.Json with support for custom converters. Works automatically with ANY component type — no registration needed. |
| EntitySnapshot | Serializable snapshot of an entity's state. |
| Vector2Converter | JSON converter for Vector2. |
| WorldSnapshot | Serializable snapshot of the entire world. |