I am trying to make an blutility for a character template where you pick a skeleton and it’ll setup some variables for you e.g. the Skeletal Mesh in the Character->Mesh.
So I have made a character blueprint like so:
UBlueprintFactory* Factory = NewObject();
Factory->ParentClass = CharacterClass;
FString Name = FString::Printf(TEXT("BP_%s"), *CharacterName);
AssetToolsModule.Get().CreateAsset(Name, DestinationFolder, Factory->SupportedClass, Factory);
UObject* CreatedAsset = AssetToolsModule.Get().CreateAsset(CharacterName, DestinationFolder, Factory->SupportedClass, Factory);
Then for a simple test to check the property editing works I have this little bit of code which tries to change the construction script boolean on the blueprint:
UBlueprint* Blueprint = Cast<UBlueprint>(CreatedAsset);
auto ConstructionProp = FindField<UBoolProperty>(Blueprint->GetClass(), "bRunConstructionScriptInSequencer");
if (ConstructionProp)
{
ConstructionProp->SetPropertyValue_InContainer(Blueprint, true);
}
Everything runs with no errors but actually setting the property value does nothing. Anyone have experience in doing something similar?