Use prefabs when you want to create the same kind of object more than once without rebuilding it by hand each time.
What a Prefab Stores
A prefab can store:
- a GameObject name
- a hierarchy of child objects
- Transform values
- components
- component field values
- asset references
That means a prefab can represent a complete authored object, such as a pickup, projectile, enemy, platform, UI panel, or player helper object.
Prefab Instances
When you place a prefab into a scene, the placed object is a prefab instance.
The Inspector can show the prefab source and whether the instance differs from the saved prefab. Use this to understand whether a scene object still matches the reusable asset it came from.
Prefab workflows help you:
- update common objects from one source
- keep repeated objects consistent
- make scene content faster to author
- reduce drift between copies
Save a Scene Object as a Prefab
When you have a GameObject set up the way you want, save it as a prefab so it can be reused.

In the Hierarchy, right-click the GameObject and choose Save as Prefab....
Use this when an object already exists in the scene and you want to turn that authored setup into a reusable asset.
Create or Instantiate from the Assets Panel
Prefab assets live in the project like other assets.

From the Assets panel, you can use prefab actions such as:
Instantiate in Sceneto place an existing prefab into the current scenePrefab From Selectedto create a prefab from the currently selected scene object
Use the Prefabs folder to keep reusable object assets easy to find.
Instantiate from Gameplay
Gameplay code can instantiate prefabs when it needs to create objects at runtime.
<?php
declare(strict_types=1);
namespace MyGame\Game\Scripts;
use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Core\Prefab;
final class EnemySpawner extends Behaviour
{
public function spawnEnemy(): void
{
$enemy = Prefab::instantiate('Assets/Prefabs/Enemy.prefab.json', 'Enemy');
if ($enemy === null) {
return;
}
$enemy->transform->position = $this->transform->position;
}
}
Use prefabs for objects that should be authored once and reused many times.
Keep Prefabs Focused
A good prefab has a clear reason to exist.
For example:
Enemy.prefab.jsonProjectile.prefab.jsonCoin.prefab.jsonPauseMenu.prefab.jsonImpactFx.prefab.json
Avoid turning one prefab into a giant catch-all object. Smaller prefabs are easier to reuse, test, and replace.