How can I make a variable with the type of an AActor?

I have made an extension of an AActor and I want to use that class to feed a SpawnActor node. Normally I would make a variable in the editor but I want to have it as a property to a C++ class. Like I did in the code and in the image below, I have to cast the variable before feeding it into the SpawnActor node and I want to know if this is normal or I am defining the object type in a wrong way. I really don’t want to add the cast node :frowning: It will clutter up things too much.

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "City")
UClass *BuildingInstanceActorClass;

void Populate();

FBuildingBlueprint()
{
	BuildingInstanceActorClass = ABuildingInstanceActor::StaticClass();
}

15291-class+problem.png

Why you need to cast? Plug in UClass direcly does not work?

@anonymous_user_f5a50610 I have to do the cast, like in the screenshot.

What message you got when you plug UClass direcly?

Try this;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "City")
 TSubclassOf<AActor> BuildingInstanceActorClass;
 
 void Populate();
 
 FBuildingBlueprint()
 {
     BuildingInstanceActorClass = ABuildingInstanceActor::StaticClass();
 }

The only change is TSubclassOf instead of UClass*.

Yup this is the solution. Thank you RiumEqua!