unity code to change the matiram of an object code example Example: unity set material gameObject.GetComponent<Renderer>().material = newMaterial;