Prefabs
Prefabs allow you to create groups of entities that can be spawned in dynamically or reused in the world and easily changed in the editor.
Last updated
Prefabs allow you to create groups of entities that can be spawned in dynamically or reused in the world and easily changed in the editor.
Prefabs must be created in the editor by right clicking in the Hierarchy and selecting "create prefab".
When you do this, a new asset will be created in your asset explorer window that can be dragged into the scene.
To edit a prefab, right click on it and click "Edit Prefab" which will open a new window to make changes to those entities.
When you save a prefab, all instances of that prefab in your scene will automatically be updated.
The All Out prefab system is currently very early in development and doesn't allow for dynamic component fields on each instance of a prefab. Each linked instance does preserve its root name, position, rotation, scale, enabled state, network flags, and sibling order when the prefab is updated.
enemy_prefab := get_asset(Prefab_Asset, "prefabs/enemy.prefab");
enemy := Scene.instantiate(enemy_prefab, spawn_position);Scene.instantiate returns the prefab's root entity. Use its optional callback when fields must be set before component ao_start methods run.
You can change an instance of a prefab in your scene back into its individual entities by right clicking it in the hierarchy and selecting "Unlink Prefab". This can be useful if you need to add dynamic fields.
Last updated