Need code snippet: Create new actor from uproperty actor pointer (C++)

This does not do what you assumed it does and intended to do. actorPrefab->GetClass() will call the GetClass() method on the UClass currently assigned to the TSubclassOf<> variable, the class of a blueprint class is BlueprintGeneratedClass. To retrieve the actual UClass (actor class) assigned simply use “*actorPrefab”.