Unreal Engine 5 · Blueprint → C++
Cast To Node in Unreal Engine 5 C++
The Blueprint Cast To node is the templated Cast<>() function in Unreal C++. It safely converts an object pointer to a derived type, returning nullptr if the cast fails.
Blueprint node & C++ equivalent

AActor* ExampleActor;
// Casting: <> = Type to cast to, () = Object to cast
ACharacter* ExampleCharacter = Cast<ACharacter>(ExampleActor);
if (ExampleCharacter)
{
// Cast Succeeded...
}
else
{
// Cast Failed...
}What does the Cast To node do?
The Cast To node attempts to interpret an object reference as a more specific type. If the object is actually that type, the Cast Succeeded pin fires with a typed reference; if not, the Cast Failed pin fires.
In C++ this is Cast<>(), Unreal's type-safe alternative to dynamic_cast. It returns a valid pointer on success or nullptr on failure.
The C++ equivalent
Call Cast<ACharacter>(ExampleActor) where the angle brackets hold the target type and the parentheses hold the object to cast. Store the result in a typed pointer such as ACharacter* ExampleCharacter.
Then check the pointer: if (ExampleCharacter) corresponds to the Cast Succeeded pin, and the else branch corresponds to Cast Failed. Always validate before using the result.
Common mistakes
Never dereference the casted pointer without checking it first. Cast<>() returns nullptr when the object is not the requested type, and using a null pointer crashes the game. Use plain Cast<>() for UObject-derived types rather than C++ static_cast or dynamic_cast.
Frequently asked questions
What is the C++ equivalent of the Cast To node in UE5?+
It is the Cast<>() template function, for example Cast<ACharacter>(ExampleActor). It returns a typed pointer on success or nullptr on failure.
How do I check if a Cast succeeded in Unreal C++?+
Test the returned pointer with if (CastedPtr). A non-null pointer means the cast succeeded; nullptr means it failed, matching the Blueprint Cast Failed pin.
Should I use Cast<> or dynamic_cast in Unreal?+
Use Cast<>() for UObject-derived types. It is Unreal's type-safe cast that integrates with the reflection system and returns nullptr on failure.