[C++] Extract BaseColor from Material

Hello,

I wish to write a exporter for UStaticMesh to OBJ + MTL. OBJ works fine (FCollisionData gives me per-face material). MTL requires me to iterate a set of UMaterialInterface. For this I wish to extract BaseColor. Is there a way to access BaseColor? Here are few things I have tried so far (none works) :

    TMap<FString, UMaterialInterface*> MaterialsUnique;
      
    for( const auto &EachMaterial : MaterialsUnique) {
      const auto Mat = EachMaterial.Value->GetMaterial();
      const FColorMaterialInput BaseColorMat = Mat->BaseColor;
      const FColor BaseColor = BaseColorMat.Constant;
    
    	UE_LOG(SLDisplay, Display, TEXT("## \t-->Material name : [ %s ][ %s ]"),
            *Mat->GetName(),
            *BaseColor.ToString());
    
    	UE_LOG(SLDisplay, Display, TEXT("## \t { %f, %f, %f }"),
            BaseColorMat.MaskR,
            BaseColorMat.MaskG,
            BaseColorMat.MaskB);
     
    	TArray<FExpressionOutput> Outputs = BaseColorMat.Expression->GetOutputs();
    	FExpressionOutput* Output = Outputs.GetData();
    	UE_LOG(SLDisplay, Display, TEXT("## \t { %i, %i, %i }"),
             Output->MaskR,
             Output->MaskG,
             Output->MaskB);
    
    	UE_LOG(SLDisplay, Display, TEXT("## \t %s { %i, %i, %i }"),
           *BaseColorMat.InputName,
            BaseColorMat.Constant.R,
            BaseColorMat.Constant.G,
            BaseColorMat.Constant.B);
    }