Preset (asset type)
A preset is a captured, named configuration of a single component. Instead of typing the same fields into every component.add call, you save a preset once and load it. Presets are component-scoped:…
When to use one
- You re-use the same component configuration in multiple places
(e.g. a "fast-jump"
Locomotionconfig, a "loud-fall"Audioconfig). - You want designers to swap configurations without editing code.
- You want a stable identity (
@<lib>::<presetName>) callers can reference without hardcoding values.
If you're capturing a whole entity assembly, use a .bundle. If
you're factoring shared logic (not configuration), use a .module.
Where it lives
- Source:
/zero/source/.../<Name>.preset/ - Identity:
<Name>(the.presetsuffix strips). - Folder shape:
preset.yaml— names the target component + lists property values. Required.README.md— instance documentation. Required.
How to create one
asset.create("preset", "<Name>")
-- Creates: /zero/source/presets/<Name>.preset/
-- preset.yaml (component name + property scaffold)
-- README.md (instance README template)
Then edit preset.yaml to point at the right component and fill in
the values you want captured.
How it operates
- Registration. Writing
preset.yamlindexes the preset against its target component name. - Loading.
preset.load("<name>")returns a plain Luau table of the preset's property values. Use the returned table directly incomponent.add, or layer overrides on top before attaching. - No live linkage. A preset is a snapshot, not a live binding. Editing the preset doesn't update entities that loaded it earlier — they have to re-attach to pick up the change.
Discovery
asset.list("preset")— every registered preset.asset.inspect("<name>")— target component, captured property values, source, this type README.cat /zero/source/<Name>.preset— same summary.
Authoring conventions
- Name presets descriptively + by the configuration they capture
(
fast_jump,slow_camera,wet_tarmac). Avoid the component name in the preset identity —preset.yaml::componentnames the binding. - One preset = one component. If you need a multi-component bundle of
configurations, that's a
.bundlewith the components pre-attached. - Document overrides callers commonly layer on top — those become the preset's de-facto API surface.
Common pitfalls
- Component name mismatch. If
preset.yaml::componentdoesn't match a registered component,preset.loadfails. Make sure the identity is correct. - Stale loads.
preset.loadreturns a snapshot. Reload after editing the preset if you want the new values, or rebuild via a freshcomponent.add. - Renaming. The folder name is the identity. Update every
preset.loadcallsite.
Related types
.component— the type a preset configures..bundle— for multi-component / multi-entity assemblies..material— conceptually similar (shader + property values), but for GPU surfaces instead of components.