set material of image unity code code example Example: c# change material in code currentObject.GetComponent<Renderer>().material = materialToAssign;