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