LInk Texture to MaterialInstanceConstant

Hi guy,

I would link a UTexture to a MaterialInstanceConstant by C++.
By reading API doc, I found a function overrideTexture(UTexture* in, UTexture*& out)

void MaterialLinkingTexture(UMaterialInstance& MatName, const TArray& Inputs)
{
	//UMaterialInstance* MyMat = LoadMatInstanceFromPath(FName(*MatName));

	for (int i = 0; i < Inputs.Num(); i++)
	{
		UTexture* TexToOveride = LoadTextureFromPath(FName(*Inputs[i].FileName));

		UTexture* OverrideTex;
		bool result = MatName.GetTextureParameterValue(FName(*Inputs[i].SlotName), OverrideTex);
		if (result)
		{
			MatName.OverrideTexture(OverrideTex, TexToOveride, ERHIFeatureLevel::SM5);
		}
		else
		{
			UE_LOG(Import, Warning, TEXT("Cannot find texture"));
		}
		
	}
}

Unfortunately, not work as expected. If there is somebody here got a solution, plz let me now. Thank.