Learn

Chapter 02 References & Essential Nodes

#013 Get Actor of Class

Need the one Game Manager in your level without a stored reference?

  • 0:54 video
  • Written lesson
  • Beginner
Video lesson: Get Actor of Class, 0:54

When you need it

Sometimes there is no overlap, no trace and no stored reference. You only know that exactly one actor of a class is placed, like a Game Manager.

How it works

Pick the Actor Class, like BP Game Manager. When the node runs, it searches the world and returns the first actor it finds. The Return Value is already typed as that class, so you can call its functions without a cast. If no actor of that class exists, it returns None.

Search once, store the result

Search once, on BeginPlay, and store the result in a Game Manager Ref variable. Then every event can use that reference.

Limits

  • With several matching actors, which one counts as “first” isn’t something to rely on. For one specific door among many, use a stored reference instead.
  • Never call it on Event Tick. Epic’s documentation calls it a slow operation.

In short

Find the actor once, store the reference and reuse it everywhere.

Covered in this lesson

  • Get Actor of Class
  • Return Value
  • None
  • Event BeginPlay

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.