/// <summary> /// Clones the given style and changes its font color. /// </summary> public static GUIStyle Clone(this GUIStyle guiStyle, Color color, bool setTurnedOnState = true, bool setTurnedOffState = true) { GUIStyle style = new GUIStyle(guiStyle); style.SetFontColor(color, setTurnedOnState, setTurnedOffState); return style; }
/// <summary> /// Draws a single press button with choice for background shade and text color. /// </summary> public static bool ColoredButton(GUIContent content, GUIStyle guiStyle, Color backgroundShade, Color fontColor, params GUILayoutOption[] options) { GUIStyle style = new GUIStyle(guiStyle); style.SetFontColor(fontColor); Color guiPrevColor = GUI.backgroundColor; GUI.backgroundColor = backgroundShade; bool clicked = GUILayout.Button(content, style, options); GUI.backgroundColor = guiPrevColor; return clicked; }