Skip to content

Blueprint Reflection C++ Reference ​

Get name and path information about an object's Blueprint from C++ with UBPReflection.

Header: BPReflection.h · Class: UBPReflection

In Blueprints these functions describe the Blueprint that called them, because the node passes in Self. In C++, they describe whatever object you pass in, based on its class. For example outputs, see the Blueprint Reflection nodes.

NameDescription
GetCallingBlueprintNameThe object's class name.
GetCallingBlueprintPathThe Blueprint's package path, or the class path.
GetCallingBlueprintInfoName and path details in one call.

NOTE

Passing this from a C++ class describes the object's runtime class. If the object is an instance of a Blueprint subclass, you get the Blueprint, not your C++ class.

GetCallingBlueprintName ​

cpp
static FString UBPReflection::GetCallingBlueprintName(const UObject* WorldContextObject);
NameDescription
WorldContextObjectThe object to describe.

Returns: The name of the object's class. For a Blueprint, this is the generated class name, ending in _C. Returns Unknown if WorldContextObject is null.

GetCallingBlueprintPath ​

cpp
static FString UBPReflection::GetCallingBlueprintPath(const UObject* WorldContextObject);
NameDescription
WorldContextObjectThe object to describe.

Returns: In editor builds (WITH_EDITOR), when the object's class was generated by a Blueprint, the Blueprint's package path, like /Game/MyGame/BP_Player. Otherwise, the class's path name, like /Game/MyGame/BP_Player.BP_Player_C, or /Script/<Module>.<Class> for a native class. Returns an empty string if WorldContextObject is null.

GetCallingBlueprintInfo ​

cpp
static void UBPReflection::GetCallingBlueprintInfo(const UObject* WorldContextObject, FString& OutBlueprintName, FString& OutContentPath, FString& OutFullPath, FString& OutFullReferencePath);
NameDescription
WorldContextObjectThe object to describe.
OutBlueprintNameReceives the Blueprint asset's name, or the class name when no Blueprint is available.
OutContentPathReceives the package path with /Game/ replaced by Content/. Empty when no Blueprint is available.
OutFullPathReceives the full package path. Empty when no Blueprint is available.
OutFullReferencePathReceives the Blueprint asset's object path, or the class path when no Blueprint is available.

The Blueprint details are only available in editor builds, for classes generated by a Blueprint. If WorldContextObject is null, OutBlueprintName is Unknown and the other outputs are empty.

Example ​

cpp
#include "BPReflection.h"

void AMyActor::LogIdentity() const
{
    FString BlueprintName, ContentPath, FullPath, ReferencePath;
    UBPReflection::GetCallingBlueprintInfo(this, BlueprintName, ContentPath, FullPath, ReferencePath);

    UE_LOG(LogTemp, Log, TEXT("%s (%s)"), *UBPReflection::GetCallingBlueprintName(this), *FullPath);
}