Class ContentCodec
The runtime direction of the value codec (plan §4.2, "one codec, both directions"). The editor direction
lives in ContentEncoder (SerializedObject semantics); this side decodes the same encodings with
cached reflection, so an apply pass pays one lookup per (type, field) per session.
Encodings handled (mirror of the encoder): primitives JSON number/bool/string, cross-converted (long → float, string → number, …) enums name strings, flags as "A, B", numeric fallback Unity value types Vector2/3/4, Quaternion, Color, Color32, Rect, Vector2Int/3Int from {x,y,…} maps; Bounds from {center,size} arrays / List<T> JSON arrays, element-wise (all elements must decode) [Serializable] obj nested maps, recursed through fields (depth-limited) references {"$in":"comp:X"} / {"$in":"path:Body/Head|comp:X"} resolved on the instance being hydrated; {"$asset":"addr"} resolved when the asset is already resident; {"$guid":…} and non-resident assets report a skip (the archetype's own reference stands)
Everything unsupported is reported as a ContentCodec.SkipReason — never silently dropped.
public static class ContentCodec
- Inheritance
-
objectContentCodec
Methods
- GetField(Type, string)
Cached field lookup (instance, public + non-public). A miss is cached as null too.
- ResolveType(string)
Simple type name → Type across the loaded assemblies (component keys are concrete class names like "WeaponBehaviour"). Cached, including misses.
- TryDecode(object, Type, out object, out SkipReason, GameObject)
Decodes one encoded value into
targetType. See the class doc for formats.