Hello everyone,
I’m having trouble finding the correct syntax to find an Actor Component.
This Actor Component is a Blueprint “BP_HeroAC” that is a child of the C++ Class “HeroAC” .
PlayerController.h
UHeroAC* HeroActorComponent;
PlayerController.cpp
static ConstructorHelpers::FObjectFinder<UHeroAC>HeroACTemp
(TEXT("/Game/Character/BP_HeroAC.BP_HeroAC"));
HeroActorComponent = HeroACTemp.Object;
I know the path is good, but I’m not sure about the overall syntax.
Thanks
domzorg
(domzorg)
2
I did that but I didn’t use the class directly, but UClass
static ConstructorHelpers::FObjectFinder<UClass> PlayerPawnBPClass(TEXT("Class'("/Game/Character/BP_HeroAC.BP_HeroAC'"));
if (PlayerPawnBPClass.Object != NULL)
DefaultPawnClass = PlayerPawnBPClass.Object;
After you can cast it to you class type.
D.
Moss
(Moss)
3
Are you calling that in the constructor of your actor?
Moss
(Moss)
4
Try it this way:
static ConstructorHelpers::FObjectFinder<UHeroAC> HeroACTemp(TEXT("HeroAC'/Game/Character/BP_HeroAC.BP_HeroAC'"));
And do it in your constructor.
Moss
(Moss)
5
Did one of the answer work for you?