static ConstructorHelpers::FClassFinder
PlayerPawnOb(TEXT(“Blueprint’/Game/Blueprints/BP_PacManChar.BP_PacManChar’”));
So I have this code, where i want to get a reference to my PacMan character, I copied exactly the string from the content browser, but it always returns null, Any suggestions??
MacDx
October 15, 2016, 9:51pm
2
Instead of this:
PlayerPawnOb(TEXT("Blueprint'/Game/Blueprints/BP_PacManChar.BP_PacManChar'"));
Try this:
PlayerPawnOb(TEXT("'/Game/Blueprints/BP_PacManChar.BP_PacManChar'"));
No that does not work either.
In my other class, i wrote
static ConstructorHelpers::FObjectFinder<UStaticMesh> Sphere(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere'"));
And this works fine, but with ClassFinder is not the same, any more ideas?
You need to add a _C
to get the class:
static ConstructorHelpers::FClassFinder<APawn>
PlayerPawnOb(TEXT("Blueprint'/Game/Blueprints/BP_PacManChar.BP_PacManChar_C'")));
Or use
static ConstructorHelpers::FClassFinder<APawn>
PlayerPawnOb(TEXT("/Game/Blueprints/BP_PacManChar")));
Thank you, the _C Version solved my problem