void SetPlayerColor(GameObject player) { int playerId = GetPlayerId(player); player.GetComponent <SpriteRenderer>().material.SetColor("NewColor1", CustomFunctions.PlayerIdToColor(playerId)); //player.GetComponent<SpriteRenderer>().material.SetColor("NewColor1", Color.white); player.GetComponent <SpriteRenderer>().material.SetColor("NewColor2", CustomFunctions.DarkColor(CustomFunctions.PlayerIdToColor(playerId))); }