Create asset with custom parent class in C++

Hello!

Does anyone know how to create a BlueprintClass with a custom parent in C++?

Basically, I want to automate this step:

Meaning, I want to create a BlueprintClass with a parent of type Building.
Does anyone ahve some tips on how to do that?

Hi melanieernst,

You use the SpawnActor method in UWorld - you specify the class as a parameter in there:

@ melanieernst , You can just right click on the C++ class from the editor, and click “Create blueprint class based on xyz”. If that’s what you asked.

Hey thanks for the link!
But I don’t want to spawn them, I want to store them in the content browser

Hey @sheikh_sadab , Do you know how to do that in C++?

Make sure your uclass is Blueprintable to be able to create a blueprint out of it and if you need it a variable then add BlueprintType

example

UCLASS(BlueprintType, Blueprintable)
class MYPROJECT_API UMyClass : public UObject {
}

@3dRaven I tried to do that, but if I try to create it with my custom factory, it never gets saved. If I try to create it with te BluprintFactory, i get an exception