how to create shadow of sprite in unity code example
Example 1: unity ui change sprite
// TO change the sprite of an UI image, se below
GameObject.GetComponent<Image>().sprite = sprite;
Example 2: unity set sprite transparency
// You can set the transparency together with the color:
SpriteRenderer.color = new Color(1f,1f,1f,1f);