Creating UMaterialInterface

Is it possible to create UMaterialInterface from UMaterial. I want to apply it to a static mesh and I am getting a material like this static ConstructorHelpers::FObjectFinder Material(TEXT(“path”)); However I have to pass UMaterialInterface to SetMaterial. How do I get it from UMaterial? Thanks.

static ConstructorHelpers::FObjectFinderMaterial(TEXT(“Material’/Game/StarterContent/Materials/M_Metal_Gold’”));
if (Material.Succeeded()) {
auto* MaterialInstance = UMaterialInstanceDynamic::Create(Material.Object, Material.Object);
StaticMeshComponent->SetMaterial(0, MaterialInstance);

In case someone else is looking for a code that sets a material to a static mesh of a static mesh component that’s the code that worked for me.