Prefabs (Object Blueprints)
This page is the prefab lookup: save, place, overrides, variants, and bundled templates. For a how-to, start with Prefabs and spawning. To spawn from code, see Scene and Spawner.
Opal stores reusable object templates in the asset library as prefabs (kind: "blueprint"). Placed nodes retain a prefabId asset link, a shared prefabInstanceId, and stable prefabNodeId source keys. Sprite asset identity remains separate from the prefab link.
Save a prefab
- Configure an object (components, motion, Object Flow graphs).
- Inspector → Actions → Save as Prefab.
- The prefab is stored in the Blueprints asset folder with components, motion, and graphs.
If the object has children, the full subtree is captured automatically.
Place or spawn
- Asset library: click a
.blueprintasset to place an instance in the scene. - Object Flow: use the Spawn Object action and pick a prefab from the dropdown.
Both paths use the same instantiate pipeline (instantiatePrefab) and restore graphs onto the new instance.
Overrides
Linked instances show override dots on changed scalar fields (name, size, rotation, opacity, group, tap action, network sync). Component field overrides appear in the linked prefab panel with per-field reset.
- Revert Prefab Overrides resets all scalar and component fields to the template.
- Update Prefab writes the current instance back to the linked asset.
- Prefab sync:
autoinstances pick up non-manual refreshes when the prefab asset is updated;manualinstances keep their overrides until you revert.
Variants
Save as Prefab Variant creates a blueprintVariant asset that stores only a diff (baseBlueprintId + overrides) against the instance's linked prefab.
Composite variants retain their captured child component settings and exposed root controls.
Exposed prefab properties
In isolated prefab editing, select the origin to add component fields to Prefab properties. Placed instances show those fields on the root, with source labels, override cues, and individual reset controls. Edits target the actual child component through the normal undo command. Exposed overrides survive updates while inherited fields receive the new defaults. Missing sources remain visible and disabled until repaired or removed.
The optional prefabExposedFields list contains { nodeId, componentType, fieldKey, label } descriptors. It is definition metadata on the primary root and top-level prefab config; values stay in component records. Stable node keys scope references to one instance, even after child renaming or reparenting. The list defaults to empty for older scenes and prefabs, so no stored-data migration is needed. Descriptor identities and labels are excluded from asset-reference scanning and remapping; component asset fields still follow the normal asset pipeline.
Default comparisons and resets use the same component version migrations as hydration, after remapping object references into that instance.
Removing an exposed control keeps its current override during that update. Later updates treat the field as an ordinary component setting. Use manual sync if that instance must retain its other component overrides.
Bundled prefabs
New installs seed demo prefabs from bundled/blueprints/ via bundled/asset-manifest.json:
- Slime Enemy
- Gold Pickup
- Enemy Spawner (timer → spawn slime)