I have some code to generate a new Blueprint asset in the content browser of a certain class. I’d like to be able to programmatically fill in some of that object’s default values before I save the package (or resave it afterward, if necessary).
The trouble is, I have no clue how to do this! I’m not very familiar with the relationship between Blueprint, GeneratedBlueprint, and the actual class that contains the properties I want to modify.
Is anybody more familiar with this and can give me some pointers?
This is the code I have to create the asset. I use the EditorUtilityBlueprintFactory to create the object, then cast that object to an EditorUtilityBlueprint - expecting that’s a step I’ll need to do. After this code block I save the asset with UPackage::Save()
.
UEditorUtilityBlueprintFactory* EditorUtilityBlueprintFactory = NewObject<UEditorUtilityBlueprintFactory>(UEditorUtilityBlueprintFactory::StaticClass());
EditorUtilityBlueprintFactory->ParentClass = MyEditorUtilityObjectClass::StaticClass();
UObject* NewObject = AssetToolsModule.Get().CreateAsset(Name, PackagePath, UEditorUtilityBlueprint::StaticClass(), EditorUtilityBlueprintFactory);
if (UEditorUtilityBlueprint* NewBlueprint = Cast<UEditorUtilityBlueprint>(NewObject))
{
// Code reaches here. But not sure how to set default properties on the asset!
}