Material Not Changing

I have a script which is meant to change the material on a non-static object, but after it failing, and more testing on other objects, I cannot get it working at all on anything, yet I cannot see any problems with the code, can anyone see what I am doing wrong?

I call MaterialIndex with an arg of 0, then Material with the new material, then ChangeMaterial with the object in question, and nothing changes, but they are being called (confirmed via Debug.Log).

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ControlMaterials : MonoBehaviour
{
    public int materialIndex;

    public Material material;

    public void MaterialIndex(int value)
    {
        materialIndex = value;
    }

    public void Material(Material value)
    {
        material = value;
    }

    public void ChangeMaterial(GameObject target)
    {
        target.GetComponent<MeshRenderer>().materials[materialIndex] = material;
    }
}

You cannot change it that way, you are changing a copy of the array. You need to do it this way:

Renderer r = meshes[i].GetComponent<Renderer>();
material[] mats = r.materials;  // copy of materials array.
mats[n] = newMaterial; // set new material
r.materials = mats; // assign updated array to materials array

Note that this is literally a copy and paste from an old question you asked: Changing Material Array Via C#