How to edit a meterial with sciprts unity code example
Example: c# change material in code
currentObject.GetComponent<Renderer>().material = materialToAssign;
currentObject.GetComponent<Renderer>().material = materialToAssign;