How can I get a reference to a blueprint in c++?

Then, access its variables and print the name of that blueprint?

Use the UBlueprint class to store a reference to your blueprint, then use GetName() or GetFriendlyName() to retrieve its name.

Edit: I ended up figuring this out and answering someone else’s question here:

Well, I found the answer to the first question, although I can’t figure out how to access any of the blueprint’s variables.

ConstructorHelpers::FObjectFinder<UBlueprint> BlueprintObj(TEXT("Blueprint'/Game/Path/SomeBlueprint.SomeBlueprint'"));

 UBlueprint* blueprint = NULL;
 if (BlueprintObj.Succeeded()) {
      blueprint = BlueprintObj.Object;

Path to blueprint is found by right clicking it in the editor and choosing copy reference.

Then to print:

 if (GEngine)
      GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, blueprint->GetName());

In the sample you posted below, simply call blueprint->GetFriendlyName(); after successfully retrieving the UBlueprint pointer and then print it using whichever printing method you’re using.

Thanks, but actual code would be much more useful to me. I just started getting into the C++ side of the Engine yesterday.

It’s the “whichever printing method you’re using” that I’m stuck on. Tried both UE_LOG and GEngine method.

 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, blueprint->GetName());

The above code won’t compiile. I’ve tried all sorts of casting methods and looking at FString to cast to whatever it needs but can’t get it to work.

Figured it out. I was getting a potentially uninitialized local variable 'blueprint' used message. I just set it to NULL. It works now.