Learn

Chapter 02 References & Essential Nodes

#012 Is Valid

Seen Accessed None in your log? Check the reference first.

  • 0:54 video
  • Written lesson
  • Beginner
Video lesson: Is Valid, 0:54

Why references go empty

A reference can be empty: it was never assigned, or its actor was destroyed. Call a function through that reference, and the call is skipped with an Accessed None error.

What Is Valid checks

Is Valid checks the object first. It returns true only if the object exists and isn’t being destroyed.

It comes in two versions:

  • The macro has two exec outputs: Is Valid and Is Not Valid.
  • The pure version returns a Boolean you can plug into a Branch.

Example: a target that can die

The player stores Current Target, an enemy. When that enemy is destroyed, Is Valid on Current Target returns false. So check before attacking: Is Valid runs the attack, Is Not Valid clears the target.

Faster: Validated Get

Right-click a getter and choose Convert to Validated Get. It becomes one node with both exec paths built in.

Don’t wrap every node, though. Check where a reference can really be None.

In short

Check the reference before you use it.

Covered in this lesson

  • Is Valid
  • Accessed None
  • Branch
  • Validated Get

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.