Prefab is a scene object that places and loads a reusable group of objects from a prefab file.
The Prefab object stores the placement transform and the file reference. The prefab file stores the child objects.
For the prefab file layout, see the Prefab format documentation.
A simple Prefab entry in items.level.json:
{
"class": "Prefab",
"name": "gas_station_prefab",
"__parent": "MissionGroup",
"filename": "/levels/example/art/prefabs/gas_station.prefab.json",
"position": [100, 200, 0],
"rotationMatrix": [1, 0, 0, 0, 1, 0, 0, 0, 1],
"scale": [1, 1, 1],
"loadMode": "Automatic"
}
| Field | Type | Description |
|---|---|---|
class |
string | Must be "Prefab". |
name |
string | Scene object name. |
__parent |
string | Parent group. |
filename |
string/path | Prefab file to load. Can point to .prefab or .prefab.json. |
position |
array[3] | Prefab placement position. |
rotationMatrix |
array[9] | Prefab placement rotation. |
scale |
array[3] | Prefab placement scale. |
loadMode |
enum/string | "Automatic" or "Manual". |
useGlobalTranslation |
bool | Compatibility/special-case transform behavior for child objects. |
filename points to the prefab file:
"filename": "/levels/example/art/prefabs/gas_station.prefab.json"
Modern prefab files usually use:
*.prefab.json
Older content may use:
*.prefab
Supported values:
| Value | Description |
|---|---|
Automatic |
Loads the prefab when the Prefab object is added. |
Manual |
Does not load automatically. The prefab must be loaded by script/tooling. |
Most level content should use:
"loadMode": "Automatic"
The Prefab transform is applied to the child objects loaded from the prefab file.
This lets a reusable object group be placed multiple times with different position, rotation, or scale.
For most content, keep:
"useGlobalTranslation": false
Use useGlobalTranslation only when matching existing content or a tool-specific workflow that expects it.
The class and the file format have different responsibilities:
| Part | Responsibility |
|---|---|
Prefab object |
Placement, transform, file reference, load mode. |
.prefab.json / .prefab file |
Child object data and root group. |
Do not duplicate all child objects in the level item file if they are meant to live inside the prefab file.
For tools that create or modify prefabs:
filename paths and keep them portable.Prefab transform separately from child object transforms.Prefab for reusable object groups, not for single static meshes.TSStatic or Forest for individual or repeated mesh placement where prefab grouping is not needed.filename is wrong or missing.loadMode is used but no script/tool loads the prefab.filename points to an existing prefab file.loadMode is intentional.Prefab object moves children as expected.Was this article helpful?