unity set sprite transparency

C#
// You can set the transparency together with the color:
SpriteRenderer.color = new Color(1f,1f,1f,1f);
Source

Also in C#: