preset
The preset namespace — 2 functions.
globals/preset/create
preset.create(name: string, entityId: string, componentType: string, opts: PresetCreateOpts?) -> PresetCreateResult
Snapshot an existing component's public property table into a
preset asset on disk. Bare names land under
/source/presets/<name>.preset/preset.yaml; absolute paths must
point to a .preset directory or its inner preset.yaml.
Parameters
namestring— Either a bare preset name (lands under/source/presets/) or an absolute path to a.presetasset.entityIdstring— Source entity id.componentTypestring— Component to snapshot (e.g."CharacterController").optsPresetCreateOpts(optional) — Optional creation options (currently just{ name = displayName }).
Returns PresetCreateResult — Metadata about the written preset: { path, entityId, component, properties }.
preset.create("my_locomotion", entityId, "CharacterController")
globals/preset/load
preset.load(source: AssetRef<preset>, overrides: table?) -> { [string]: any }
Load a preset asset and return the plain component property table.
Parameters
sourceAssetRef<preset>— Ref-like input that must resolve to a preset asset before the function body runs.overridestable(optional) — Optional table merged onto the loaded properties.
Returns { [string]: any } — Plain table suitable for entity(id).component.add(type, data).
preset.load("@builtin::systems.characterController.presets.synty")
preset.load("/source/presets/my_locomotion.preset", { walkSpeed = 3.0 })