I want to create a static class or singleton as a config for my custom Editor GUI styles, instantiate that styles, update it when the script was edited, and use that styles for the other Editor scripts.
I’ve found out that the following works:
public class CustomStyles
{
public static readonly GUIStyle Header =
new GUIStyle(EditorStyles.miniButton) {
padding = new RectOffset(10, 3, 0, 0),
alignment = TextAnchor.MiddleCenter,
margin = new RectOffset(5, 5, 0, 0)
};
public static readonly GUIStyle HeaderButton =
new GUIStyle(EditorStyles.miniButtonMid) {
padding = new RectOffset(0, 0, 0, 0),
margin = new RectOffset(0, 0, 0, 0),
alignment = TextAnchor.MiddleCenter,
fixedHeight = 18
};
public static readonly GUIStyle StretchedButton =
new GUIStyle(GUI.skin.button) {
alignment = TextAnchor.MiddleCenter,
stretchWidth = true
};
}