Alkibit Serialization — Runtime GameObject Serializer — SaveLoad System


Samples ... Notes ... Load that JSON and you get the hierarchy back, not a pile of disconnected objects. Use it for save games, deep clones, spawning from saved state, and sending object ...


by Alkibit


Price History +

Serialize and save any GameObject to JSON at runtime and rebuild it with every reference intact. Saves, deep clones, networking. 79 built-in component types, reflection fallback for the rest.

Core

• Runtime serialization of GameObject hierarchies to JSON — children, components, field values and references


• Single-object and multi-root serialization (GameObject.Serialize(), IEnumerable<GameObject>.Serialize()); multiple roots in one payload keep cross-references between them


• Single-component serialization via GameObjectSerializer.GetDataFromComponent()


• Load(Transform parent = null) / LoadAll(Transform parent = null) — restore one root or all roots, optionally parented under a Transform with local TRS preserved


• LoadCoroutine / LoadAllCoroutine — the same load spread across several frames


• Three-pass deserialization: create (inactive) → populate fields → activate + post-activate state (Rigidbody/Rigidbody2D velocity, Animator playback position, and similar)


• Versioned payload format (GameObjectSerializer.PayloadVersion); a reader warns and returns null rather than throwing on an unknown or malformed payload


Component and type support

• 79 built-in Unity component types supported directly; 70 of them via the declarative MappedComponentSerializer<T> + ComponentMap<T> form


• Reflection fallback for user components and unmapped types


• Custom component serializers, custom value serializers (Serializer.Values.Register), and custom asset resolvers (IAssetResolver) are all registerable


• Independent Serializer instances with their own registries and filters; static entry points forward to Serializer.Default


• Serializer.IdSeed for reproducible payload ids


References

• GameObject-to-GameObject, component-to-component, asset, and prefab-asset references


• Arrays and Lists of any of the above


• Assets resolved through AssetRegistry.Register(asset, key), with ordered fallback resolvers and a lazy Resources/ scan


• Scene objects stored by path; SerializationId gives a scene object a rename-proof id


• Default nesting depth for nested classes is 4 (StringSerializer.MaxNestingDepth), configurable; reference cycles are detected and reported by type


Compression

• Key compression (PayloadCompression.CompressJson): fixed table, lossless, output stays valid readable JSON, roughly 72% of minified size — not idempotent, call once per payload


• GZip as byte[] or Base64, roughly 23% of minified size; both encodings can be combined


• SerializationJson.FromJson auto-detects plain, key-compressed and gzip-Base64 input


• PayloadCompression.MaxDecompressedBytes caps gzip inflation at 64 MB


Security

• LoadOptions.ComponentTypeFilter — per-call allowlist of component types that may be instantiated


• LoadOptions.PersistentCallFilter — per-call allowlist of methods a restored UnityEvent may bind


• LoadOptions.MaxObjectCount / MaxDepth — refuse an over-budget payload before building anything


• Process-wide equivalents exist (GameObjectSerializer.ComponentTypeFilter, UnityEventSerializer.PersistentCallFilter); per-call LoadOptions is preferred


Diagnostics

• SerializationLog.Sink routes package warnings into your own logger


• SerializationLog.MaxMessagesPerCall caps warnings emitted by a single Serialize/Load


Compatibility

• Unity 6.6 (6000.6) or newer — relies on built-in Dictionary<,> serialization


• Dependency: com.unity.ugui (provides TextMeshPro; referenced directly, required)


• Output format: JSON only


• No editor-only code paths required at runtime; test framework is not a runtime dependency


Included

• Full source (C#)


• EditMode and PlayMode test suites


• Samples


• Documentation (Documentation~/SERIALIZATION.md) and CHANGELOG


Notes

• Beta: payload format is stable and versioned, C# API may still change between releases


• Payloads written by 0.1.x are not readable by 0.2.x — re-save before upgrading; no converter


• Several internal pipeline members are [Obsolete] since 0.2.1 and slated for removal in 0.3.0


Serialize a GameObject tree to JSON. Load it back with every reference wired up.

Alkibit Serialization is a runtime serialization system for Unity GameObject hierarchies. Point it at a GameObject and it writes the whole tree — children, components, field values and the references between them — to readable JSON. Load that JSON and you get the hierarchy back, not a pile of disconnected objects.

Use it for save games, deep clones, spawning from saved state, and sending object state across a network.


What it handles

• Whole hierarchies, or several independent roots as a single payload so cross-references between them survive


• References between GameObjects and between components on different objects


• Asset references — Materials, Textures, AudioClips, prefab assets — resolved through an asset registry


• Arrays and Lists of any of the above


• 79 built-in Unity component types, with a reflection fallback so your own components serialize without extra work


• Scene object references, stored by path, with an optional rename-proof id component


Three-pass loading

Objects and components are created first (empty and inactive), then every field is populated, then the objects are activated. A reference always has something to resolve to, and your Awake/OnEnable sees restored state instead of defaults. Post-activation state that Unity only accepts on a live object — Rigidbody velocities, Animator playback position — is applied last. Coroutine variants spread the same three passes over several frames so a large load doesn't stall a frame.


Compression, optional and lossless

Key compression shortens the payload's own field names to roughly 72% of minified size while staying readable JSON. GZip gets to roughly 23%, as bytes or Base64. Loading detects the format automatically, so a reader never has to know which form a file holds.


Built for untrusted payloads

Loading a payload from a network or from disk is gated per call: an allowlist for which component types may be instantiated, an allowlist for the methods a restored UnityEvent may bind, and object-count and depth caps that reject an over-budget payload before anything is built. Malformed, truncated or wrong-format input returns null with a warning instead of throwing.


Extensible

Register custom component serializers (2-3x faster than reflection for types you serialize often), add support for your own value types, plug in custom asset resolvers, or run independent serializer instances with their own registries and filters. Package warnings can be routed into your own logger.


Requirements

• Unity 6.6 (6000.6) or newer — the payload format relies on built-in Dictionary serialization


• com.unity.ugui (provides TextMeshPro; required, not optional)


Ships with EditMode and PlayMode test suites and runnable samples. Full API documentation is included in the package.

Beta. The payload format is stable and versioned; the C# API may still change between releases.