Python
# get the generated class of the Blueprint (note the _C)
bp_gc = unreal.load_object(None, "/Game/MyBP.MyBP_C")
# get the Class Default Object (CDO) of the generated class
bp_cdo = unreal.get_default_object(bp_gc)
# set the default property values
bp_cdo.set_editor_property("MyFloatProp", 1.0)
bp_cdo.set_editor_property("MyBoolProp", True)
C++
FString BPPhysicalActorPath = "/Game/CustomAssetAnim.CustomAssetAnim";
UObject* LoadedAsset = AssetRegistryModule.Get().GetAssetByObjectPath(*BPPhysicalActorPath).GetAsset();
UBlueprint* Blueprint = Cast<UBlueprint>(LoadedAsset);
UClass* InClass = Blueprint->GeneratedClass.Get();
UBlueprintFactory* Factory = NewObject<UBlueprintFactory>();
Factory->ParentClass = InClass;
UObject* BP = AssetToolsModule.Get().CreateAsset(GroupID, PackagePath, nullptr, Factory, FName("BlueprintAnimationActor")); Packages.Add(AssetRegistryModule.Get().GetAssetByObjectPath(*BPPhysicalActorPath).GetPackage());
UProperty* Property = InClass->FindPropertyByName(FName("Angle"));
float* PtrValue = Property->ContainerPtrToValuePtr<float>(InClass->GetDefaultObject());
if (PtrValue)
{
UE_LOG(SpawnArchWithAnimLog, Display, TEXT("++++++%f"), *PtrValue);
*PtrValue = 100;
}
FBlueprintEditorUtils::MarkBlueprintAsStructurallyModified(Blueprint);