how to set material of object in unity code example Example: unity set material gameObject.GetComponent<Renderer>().material = newMaterial;