I’m trying to recreate some structs in C++, but I can’t seem to add a variable of an actor class(not object) through code. Currently I’m trying this: *markdown doesn’t seem to like <> within code brackets, substituting with [].
ItemDataStruct.h
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Item Data Struct")
TSubclassOf\[class AActor\] mPickupClass;
ItemDataStruct.cpp
FItemDataStruct::FItemDataStruct()
{
static ConstructorHelpers::FClassFinder\[AActor\] ClassFinder(TEXT("class'Engine.AActor'"));
mPickupClass = ClassFinder.Class;
}
Now if I compare this struct to the blueprint version I have, in the c++ struct I still get an object reference. Not what I’m looking for.
As a side note, in the First Person Shooter C++ template there’s this code
ProjectGameMode.cpp
static ConstructorHelpers::FClassFinder[APawn] PlayerPawnClassFinder(TEXT("/Game/FirstPerson/Blueprints/FirstPersonCharacter"));
DefaultPawnClass = PlayerPawnClassFinder.Class;
If I make a variable identical to DefaultPawnClass, it won’t even show up in the editor. Perhaps I have a fundamental misunderstanding of how this works, but I don’t know what causes that issue.