using UnityEngine; using UnityEngine.UI; public static class GraphicExtends { #region Graphic public static void SetColor(this Graphic graphic, Color c) { graphic.color = c; } public static void SetColor(this Graphic graphic, float r, float g, float b, float a = 1) { graphic.color = new Color(r, g, b, a); } public static void SetColor32(this Graphic graphic, byte r, byte g, byte b, byte a = 255) { graphic.color = new Color32(r, g, b, a); } public static void SetColorAlpha(this Graphic graphic, float val) { Color c = graphic.color; c.a = val; graphic.color = c; } #endregion }