public static void SetUIColor(GameObject go, int r, int g, int b, int a) { Color colorWith255Int = Util.GetColorWith255Int(r, g, b, a); Graphic[] componentsInChildren = go.GetComponentsInChildren <Graphic>(true); int i = 0; int num = componentsInChildren.Length; while (i < num) { componentsInChildren[i].color = colorWith255Int; i++; } }