C++ equivalent of Blueprint class reference

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 [].


UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Item Data Struct")
TSubclassOf\[class AActor\] mPickupClass;

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


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.

Is your struct properly marked up with the appropriate USTRUCT() macros? You can get rid of that class finder code, as that is the same as AActor::StaticClass() and is also not needed. For instance:

struct FMyCoolStruct

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SomeCat)
	TSubclassOf<class AActor>  MyClassType;


Yes, here’s a snippet of the struct.


struct FItemDataStruct
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Item Data Struct")
	TSubclassOf[class AActor] mPickupClass;

After coming back to this problem a few days later, my problem has been solved. I’m assuming that it was because I wasn’t pressing compile in the editor after restarting. Anyway, I’m marking this as solved, thanks for the help.