Prefabs are the engine’s reusable entity bundles. They are not a separate runtime system; they are the place where the most common component and resource setups are packaged so app code and scene code do not have to assemble the same component combinations over and over.

Why Prefabs Exist

A prefab is useful when a setup has a stable shape e.g:

That makes prefabs a bridge between the component model and higher-level engine flow. They reduce setup noise without hiding how components are assembled.

Engine Prefabs In Practice

The render features ship the render-oriented prefabs: createCamera2D, createCamera3D, and createBasicMesh. Those are the standard starting points for a visible world, especially when paired with Rendering and asset-backed meshes from Assets and handles.

The window feature ships createMainWindow, which is the equivalent bootstrap for the browser surface. It creates the primary window entity so the rest of the runtime has a canvas to render into and a window state to read from.

Prefabs And Scenes

Prefabs matter even when a scene is the top-level handoff. Scenes can restore authored content into live entities, but the scene still needs a consistent shape for common runtime pieces like cameras, render setup, or the primary window. Prefabs are the reusable building blocks for that shape.

The practical rule is: use a prefab when the bundle is structural, and use a scene when the bundle is authored content. Both end up as entities with components, but they solve different parts of the setup problem.