Sorry about the delay. I was able to reproduce this crash here. Note that there is a specialized library function for changing the parent of a material instance. Unfortunately, though, using that function also results in a crash. For your information, the function is:
// C++ UMaterialEditingLibrary::SetMaterialInstanceParent(UMaterialInstanceConstant* Instance, UMaterialInterface* NewParent)``# Python unreal.MaterialEditingLibrary.set_material_instance_parent(cls, instance: Optional[MaterialInstanceConstant], new_parent: Optional[MaterialInterface]) -> NoneI have filed an internal bug report for this issue, and I will get back to you with the public bug tracking number as soon as I have it.
While this is not fixed, you can work around the crash by implementing your own function in a C++ BlueprintFunctionLibrary as follows:
`#include “MyEditorLibrary.h” include “MaterialEditor/MaterialEditorInstanceConstant.h”
void UMyEditorLibrary::SetMaterialInstanceParent(UMaterialInstanceConstant* Instance, UMaterialInterface* NewParent)
{
if (!Instance)
return;
FProperty* ParentProperty = MaterialEditorInstance->GetClass()->FindPropertyByName(TEXT(“Parent”));
if (ParentProperty)
{
MaterialEditorInstance->Parent = NewParent;
FPropertyChangedEvent ParentChangedEvent = FPropertyChangedEvent(ParentProperty);
MaterialEditorInstance->PostEditChangeProperty(ParentChangedEvent);
}
}`I hope this is helpful. Please let me know if this solution works for you, and do not hesitate to ask if you have any further questions.