unity set sprite color in script code example
Example: how to change the color of a sprite in unity
//option 1
GetComponent<spriteRenderer>().color = Color.red
//option 2
sprite.color = new Color (R, G, B, A);
//option 1
GetComponent<spriteRenderer>().color = Color.red
//option 2
sprite.color = new Color (R, G, B, A);