Failed to find path to object


i am trying to spawn a blueprint from c++, here are the first few lines :

ADE_HUD::ADE_HUD(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
	static ConstructorHelpers::FObjectFinder<UClass>MyObj(TEXT("Blueprint'/Game/Blueprints/PickUp.PickUp'"));
	if (MyObj.Object!=NULL) MyBP= (UClass*)MyObj.Object->GetClass();

But the editor keep telling that he cannot find it :

LogUObjectBase:Warning: Error: CDO Constructor: Failed to find Blueprint'/Game/Blueprints/PickUp.PickUp'

If i right click the Blueprint and copy reference i get this :


And here is a picture just to make sure :


I can’t find out, why does the editor can’t find this asset ?

Not entirely sure why it would not be picking up that reference, but you could try:

static ConstructorHelpers::FObjectFinder<UBlueprint>MyObj(TEXT(“Blueprint’/Game/Blueprints/PickUp.PickUp’”));

seen as you cast to a UClass after anyway it should work fine.

Thanks a lot that was it, didnt think of that !

An even simpler and less error-prone method (what if you change the name of the BP in the editor for example, that will invalidate the C++)

is to add this to your .h file

UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=BPClasses)
UClass* MyBP;

then compile that

then in the editor

you can select the BP

make sure it ends with _C !

Advantage: Less cumbersome, and if you change the name of your BP in the editor, the editor will update the reference for the class that has this in the .h file.

Also easier to look at once you add like 50 BP classes as properties to a single primary class that stores this sort of info.

one note:

do not rely on the acquired BP value until AFTER post Init, it wont be valid yet in the constructor



Thanks! Adding C to the copied blueprint reference worked for me. I didn’t have to declare anything in the header. My constructor looks like this:

static ConstructorHelpers::FObjectFinder<UClass> PlayerPawnBPClass(TEXT("Blueprint'/Game/Blueprints/Blueprint_Nugget_Vehicle.Blueprint_Nugget_Vehicle_C'"));
if (PlayerPawnBPClass.Object != NULL)
    DefaultPawnClass = PlayerPawnBPClass.Object;

But this is the reference the content browser supplies:


Any idea why it doesn’t include the _C suffix?

using a hard-coded reference is an outdated method and Epic only recently stopped using the _C extension

The less error-prone method is my higher post :slight_smile:

you only add the line in the .h and then compile and add the reference in editor in BP defaults.

In BP defaults you wont see the _C, so dont worry about that :slight_smile:


That is a reference to the Blueprint, not the Class. I know that is confusing! Think of the Blueprint as the ‘class factory’, it includes all the information needed to make the class, but when you are running the game, what you want is the class. You can go Blueprint->GeneratedClass, or know that if the Blueprint is called Foo, the class is called Foo_C.

We are actually working to make the Class the main thing you see in the Content Browser, which would mean it has the ‘right name’, and would avoid all this confusion. Another benefit is that we could stop loading the Blueprint object altogether in cooked builds.

Thanks Rama and JamesG, that all makes sense!