Learn

Chapter 02 References & Essential Nodes

#016 Do Once

Your chest gives loot every time the player walks in?

  • 0:53 video
  • Written lesson
  • Beginner
Video lesson: Do Once, 0:53

How Do Once works

Do Once has two exec inputs: the unnamed input and Reset.

  • The first pulse passes through and fires Completed.
  • Every pulse after that is blocked. Nothing runs.
  • Send a pulse into Reset, and the next one gets through again.

Example: loot once

On Component Begin Overlap goes into Do Once, then Give Loot. The player walks in: loot, once. Walk out and back in: the overlap fires, but Do Once blocks the pulse.

Want the chest to work again later? Wire a Respawn Chest event into Reset.

One state per actor

Each Do Once node keeps its own state, per actor instance. With ten chests placed, every chest gives its loot once.

When a Boolean is better

Other Blueprints can’t read Do Once. If they need to know whether it already fired, use a Boolean variable instead. For “once per whole game”, store that Boolean somewhere shared, like the Game Instance.

In short

The first pulse passes. The rest wait for Reset.

Covered in this lesson

  • Do Once
  • Reset
  • Completed
  • On Component Begin Overlap
  • Game Instance

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.