Learn

Chapter 06 Actors & Components

#053 Spawn Actor

Enemies, bullets, pickups. Anything that appears mid-game comes from Spawn Actor from Class.

  • 1:15 video
  • Written lesson
  • Beginner
Video lesson: Spawn Actor, 1:15

Creating actors while the game runs

Placing every enemy by hand can’t handle waves, or anything created during play.

Spawn Actor from Class creates a new actor while your game runs. Pick a Class, and the Return Value becomes that exact type, so no cast is needed.

  • Spawn Transform sets where it appears, its rotation, and its scale.
  • Collision Handling Override decides what happens when that spot is blocked. Pick the option that refuses to spawn, and a blocked spot returns None, so check the result with Is Valid.
  • Tick Instance Editable and Expose on Spawn on a variable, and it appears as a pin on this node.

Example: a wave spawner

Every two seconds, a timer calls Spawn Actor from Class, with BP Enemy as the Class.

Health is exposed on spawn, so each wave sets its own value: one hundred, then two hundred. That value is set before Begin Play, so every enemy starts with its correct Health.

Add each Return Value to an array to track every living enemy.

Common mistakes

  • Spawning on every Tick. Spawning has a real cost.
  • Set Owner when an actor belongs to another, like a projectile fired by your player.

In short

Pick a class, a transform, and spawn.

Covered in this lesson

  • Spawn Actor from Class
  • Spawn Transform
  • Collision Handling Override
  • Is Valid
  • Expose on Spawn
  • Instance Editable
  • Set Timer by Event

Newsletter

Development updates are coming to your inbox.

The newsletter opens soon. Until then, new lessons, tools and Beach Hunters progress appear first on our channels, linked below.