Is Valid¶
At a glance
Lives in: Blueprint API / Utilities ·
Returns: Boolean - true means the object reference is usable right
now; false means None or already being destroyed ·
Fails by: returning false or taking the Is Not Valid exec path,
silently - no error, no log, no repair ·
Official page: Is Valid
The one-minute version¶
Is Validanswers "can I safely use this object reference right now?"- It checks two things: the reference is not
None, and Unreal has not started destroying that object. - It is stronger than
== None, because== Noneonly catches empty references. It does not catch the "this actor is on its way out" case. - It is different from Cast To X. A cast asks "is this
the right class?"
Is Validasks "is this reference still alive enough to touch?" - In an Animation Blueprint, use it before reading a cached owner variable on Update Animation, because editor preview, respawn, and destruction can all leave the variable empty or stale.
What it actually does¶
Blueprint object variables are references. A variable named OwnerCharacter
does not contain the whole character; it points at a character object that
exists somewhere in the world. Is Valid checks whether that pointer currently
points at a usable Unreal object.
pseudocode of the engine's behavior - not engine source
function IsValid(Object):
if Object is None:
return false
if Object has started Unreal's destruction path:
return false
return true
The exec-style Blueprint node is just a convenience shape for the same question:
if IsValid(Object):
run Is Valid path
else:
run Is Not Valid path
That "started destruction" piece is the reason the node exists. Unreal gameplay
usually does not throw exceptions when a Blueprint reference is empty. Instead,
if you call through a bad reference, the call is skipped and play-in-editor
reports an Accessed None style warning. Is Valid lets your graph choose a
clean path before that happens.
When it fails (and what failure does)¶
Is Valid fails by returning false or by routing execution through Is Not
Valid.
Common causes:
- The reference was never set.
Try Get Pawn Ownercan returnNonein the Animation Blueprint editor preview, so a cachedOwnerCharactervariable may also be empty there. - The object was destroyed. A projectile hit something, a pickup was collected, or a character died and the pawn is being replaced.
- The timing is earlier than you think. During setup, construction, spawning, possession, or animation initialization, the object you want may not exist yet.
- You cached a reference across a respawn. The old pawn is gone; the controller or animation instance may need to find the new pawn and store it.
Failure has no side effects. It does not create the object, delay execution, retry next frame, print a message, or keep the object from being destroyed. Your graph decides what to do on the invalid path.
The pattern everyone actually uses¶
Use Is Valid at the point where an empty reference would make the next node
wrong.
For the founding Animation Blueprint chain:
Event Blueprint Initialize Animation ->
Try Get Pawn Owner -> Cast To BP_YourCharacter ->
store OwnerCharacter.
Event Blueprint Update Animation ->
Is Valid (OwnerCharacter):
- Valid: read the character data needed by the state machine.
- Not Valid: either do nothing for this frame, or try the initialize lookup again if your game supports respawn or mesh swapping.
For one-off overlap or hit events, it is normal to combine the checks:
Other Actor -> Is Valid -> Cast To BP_Door -> call Open.
In C++, the equivalent check is short (our own example code):
if (IsValid(OwnerCharacter))
{
GroundSpeed = OwnerCharacter->GetVelocity().Size2D();
}
Lookalikes - which one do I want?¶
| Node | Question it asks | Use when |
|---|---|---|
| Is Valid | "Is this object reference usable right now?" | You are about to read from or call into an object reference that may be empty or stale. |
== None |
"Is this reference empty?" | You only need the simple empty-reference check and do not care about destruction state. |
| Cast To X | "Is this object the target class or a child class?" | You need class-specific variables or functions after a broad pin like Actor or Pawn. |
| Is Valid Class | "Is this class reference usable?" | You are checking a class asset/type, not a live object instance. |
| Is Valid Soft Object Reference | "Does this soft reference point at an asset path?" | You are checking an asset reference that may not be loaded. This is not the same as checking a spawned actor. |
| Is Valid Interface | "Does this interface wrapper have a valid object behind it?" | You are working with Blueprint interface values. |
Rule of thumb: Is Valid before using a possibly-empty reference; Cast To X
before using subclass-specific members; both when you need both answers.
Going deeper¶
- Ownership and lifetime - why a reference can outlive the thing it used to point at.
- Cast To X - the separate type-check question beginners often mix up with validity.
- Try Get Pawn Owner - a
node that legitimately returns
None, makingIs Validpart of the normal AnimBP pattern. - Engine source (requires engine access - we do not reproduce it here):
UKismetSystemLibrary::IsValidinEngine/Source/Runtime/Engine/Private/KismetSystemLibrary.cpp.