Skip to content

@modoki/engine / index / readTraitDataFull

Function: readTraitDataFull()

readTraitDataFull(entityId, meta): Record<string, unknown> | null

Like readTraitData but returns EVERY persistent field the trait holds, not just the curated Inspector subset in meta.fields. SoA traits expose a plain-object schema (every field is a key); AoS traits (trait(() => ({…})), e.g. AnimationLibrary's animSets/boneMaps, SkinnedMeshRenderer's materials, UIAction's onClickSet) expose schema as a function / undefined — for those we fall back to the LIVE object's own keys. Use this for serialization / prefab override capture: readTraitData would silently DROP an AoS object/array field that isn't declared in meta.fields (the bone-map-lost-on-save bug). Mirrors the key-enumeration serializeScene already does inline.

Parameters

entityId

number

meta

TraitMeta

Returns

Record<string, unknown> | null

Built with Modoki.