"class" variable

So if you select class pointer as a variable type in BP, this happens:

But how do you declare these variables in C++?

I’ve tried these but neither work :confused:


ClassName Varname;
ClassName& Varname;

Should be TSubclassOf<ClassName> Varname. Where I believe ClassName has to be UObject or any UObject derived class.

Or you can use UClass* Name too. But if you want the class variable to be set inside the editor, do it like this : UPROPERTY(EditdefaultsOnly) TSubclassOf<> Name;

Thanks for the response :smiley: