Sharing: Creating new GUIStyle for LabelField

Hi All, just to sharing some tips about setting up the Node label:

    private GUIStyle GetNewGUIStyle()
    { // this is setting up all kinds of styles for any given field:
        GUIStyle newLabelStyle = new GUIStyle();
        newLabelStyle.fontSize = 13;
        newLabelStyle.fontStyle = FontStyle.BoldAndItalic;
        newLabelStyle.normal.textColor = Color.white;
        return newLabelStyle;
    }

        // create a LabelField called "Node" and pass into a new GUIStyle for this LabelField;
        EditorGUILayout.LabelField("Node:", GetNewGUIStyle());

Then you would have an Bold and Italic Label font like the following:

image

3 Likes

Privacy & Terms