Learn

Chapter 02 References & Essential Nodes

#014 Get All Actors of Class

Need every lamp in your level at once?

  • 0:55 video
  • Written lesson
  • Beginner
Video lesson: Get All Actors of Class, 0:55

How it works

Pick the Actor Class, like BP Lamp. When the node runs, it searches the whole world and fills Out Actors, an array of every match.

  • No matches? You get an empty array, not None.
  • Never rely on the order of the array: it isn’t guaranteed.

Acting on each actor

Drag from Out Actors into a For Each Loop. Loop Body runs once per lamp, and Array Element is that lamp. Call Turn Off on each element. Completed fires after the last lamp.

Only the count, or only some

  • Need only the count? Use the array’s Length.
  • Need only some lamps? Tag them and use Get All Actors with Tag.

Search once

Like Get Actor of Class, this is a slow operation. Search once, on BeginPlay or on an event, and store the array in a variable. Calling it on Event Tick repeats the full search every frame.

The stored array is a snapshot: lamps spawned later won’t be in it.

In short

Every match, in an array. Search once, then loop.

Covered in this lesson

  • Get All Actors of Class
  • Out Actors
  • For Each Loop
  • Array Element
  • Length
  • Get All Actors with Tag

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.