void GiveColor(string newColor, string prevColor, string playerName) { PlayersList.GiveColor(newColor, prevColor, playerName); //Debug.Log(newColor + "is taken by someone."); GameObject player = PlayersList.GetPlayer(playerName); int index = Array.IndexOf(COLORS, newColor); Color color = colors[index]; // Change the color //Material BodyMat = player.GetComponentInChildren<MeshRenderer>().material; //BodyMat.color = color; }