Modify member variables in a UBlueprint object, through C++ (for .uasset saving)

Hi there!

I’m working on a plugin and want to automatically generate UBlueprints, and save them as assets in the editor. I’ve got this working with FKismetEditorUtilities::CreateBlueprintFromClass(), but I’ve not been able to figure out how to modify the object’s member variables in C++, after creation.

Anyone able to point me in the right direction?


Hello future internet people! Guess I asked too quickly.

  1. Create a new package
  2. NewObject<>() to create the CDO
  3. Modify your new object as desired
  4. FKismetEditorUtilities::CreateBlueprintFromActor()

    FString PackagePath = FString(TEXT("/Game/CreateTest/SomeClass_BP"));
    UPackage* NewPackage = CreatePackage(nullptr, *PackagePath);
    ASomeClass* SomeClassToCreate = NewObject<ASomeClass>(Cast<UObject>(NewPackage), ASomeClass::StaticClass());

    if (SomeClassToCreate)
        SomeClassToCreate->bWasThisEditedInCode = true;
        UBlueprint* NewBlueprint = FKismetEditorUtilities::CreateBlueprintFromActor(FName(TEXT("SomeClass_BP")), NewPackage, SomeClassToCreate, false, false);