{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Is Valid in Unreal Engine 5 C++

The Is Valid node maps to a simple pointer null check (if (Object)) or to UKismetSystemLibrary::IsValid(), both of which guard against using invalid objects.

Blueprint node & C++ equivalent

Is Valid Blueprint node and its C++ equivalent in Unreal Engine 5
The “Is Valid” Blueprint node.
C++
AActor* ExampleActor;

// Check validity
if (ExampleActor)
{
	// Is Valid...
}
else
{
	// Is Not Valid...
}
C++
#include "Kismet/KismetSystemLibrary.h"

AActor* ExampleActor;

// Check validity
if (UKismetSystemLibrary::IsValid(ExampleActor))
{
	// Is Valid...
}
else
{
	// Is Not Valid...
}

What does the Is Valid node do?

Is Valid confirms that a reference points to a usable object before you call functions on it, preventing crashes from null or destroyed actors. In Blueprint it splits execution into valid and not-valid branches.

In C++ the most common form is a direct null check, while UKismetSystemLibrary::IsValid adds handling for objects pending destruction.

The C++ equivalent

The simplest equivalent is if (ExampleActor), which tests whether the pointer is non-null. For a check that also rejects objects being garbage collected or pending kill, include Kismet/KismetSystemLibrary.h and call UKismetSystemLibrary::IsValid(ExampleActor).

Both forms branch into valid and not-valid paths, matching the two execution pins on the Blueprint node.

When to use each form

A plain null check is fast and fine for most cases. Prefer UKismetSystemLibrary::IsValid (or the global IsValid()) when a pointer might still be set but reference an actor that has been destroyed, since a non-null pointer alone does not guarantee the object is alive.

Frequently asked questions

How do I check if an actor is valid in UE5 C++?+

Use if (ExampleActor) for a null check, or UKismetSystemLibrary::IsValid(ExampleActor) from Kismet/KismetSystemLibrary.h to also catch objects pending destruction.

What is the difference between a null check and IsValid?+

A null check only confirms the pointer is non-null. IsValid additionally returns false for objects that are being garbage collected or pending kill, even if the pointer is still set.

Related Utilities nodes

View all Utilities nodes →