unity ui change sprite code example
Example: unity ui change sprite
// TO change the sprite of an UI image, se below
GameObject.GetComponent().sprite = sprite;
// TO change the sprite of an UI image, se below
GameObject.GetComponent().sprite = sprite;