public void UpdateHud() { string number = ""; Dictionary <FactionData, int> ships = new Dictionary <FactionData, int>(); foreach (var s in Data.Ships) { if (ships.ContainsKey(s.Faction)) { ships[s.Faction]++; } else { ships.Add(s.Faction, 1); } } if (ships.Count != 0) { foreach (var n in ships) { number += "[" + Subs.ColorToHex(n.Key.Color_) + "]" + n.Value + "\n"; } } ship_amount_label.text = number; }