Applying shader properties adjustement on material at runtime?

Good day,

I’m trying to change the properties of the material/shader at runtime. I can see the values changing in the inspector, but the material doesn’t apply those changes (the preview remains the same). What am I doing wrong?

 private void InitializeMaterials()
    {
        List<Material> mats = new List<Material>();

        foreach (Texture2D texture in m_Textures)
        {
            Material mat = new Material(Shader.Find("HDRP/Lit"));

            mat.SetTexture("_BaseColorMap", texture);

            if(texture.name.Split('_')[4].ToLower() == "base")
            {
                mat.SetFloat("_SurfaceType", 0.0f);
            }
            else
            {
                mat.SetFloat("_SurfaceType", 1.0f);
            }

            mat.SetFloat("_AlphaCutoffEnable", 1.0f);
        }

        m_MeshRenderer.materials = mats.ToArray();
    }

This is what I get.

This is what I want.

So I ended up doing something else to solve my issue:

mat.CopyPropertiesFromMaterial(GameManager.Instance.m_Body.m_BaseMatPrefab)

So I created materials with all the properties I wanted and just copied them in the code.