ReferenceScene Graph

Scene Graph Spawn Entity

Spawn a prefab into the running scene to create an entity at runtime — drop an enemy, a pickup, an effect, fully assembled with its components.

Updated Compile verifiedExamples verified on the live UEFN compiler

A prefab is a saved blueprint of an enemy — its mesh, its health, its AI, all packaged together. Spawning drops a brand-new copy into the game while players are already playing.

Think of one stamp pressed onto fresh paper. The prefab is the stamp; every Spawn call presses out one identical enemy, fully assembled, ready to fight.

We give our device an editable npc_spawner field called EnemyMaker, then point it at our enemy prefab in the editor. When the game begins, EnemyMaker.Spawn pops one enemy into the level, and Print confirms it landed at runtime.

One prefab, many copies — call Spawn whenever you need a new entity in the running scene.

spawner_device := class(creative_device):
    @editable
    EnemyMaker : npc_spawner_device = npc_spawner_device{}
    OnBegin<override>()<suspends>:void =
        EnemyMaker.Spawn()
        Print("Enemy dropped into the level")

Build your own lesson with scene_graph_spawn_entity

Generate a personalized, compile-checked lesson grounded in this exact reference.

Build a lesson →