How to get a bold Labelfield (EditorGUIStyle)

How do I get a Labelfield showing bold letters? I tried using a modified style, but the Labelfield doesn’t accept the new style as an option:

EditorGUILayout.LabelField("", "Headline:", GUILayout.MinHeight(20),GUILayout.MaxWidth(320),boldtext);

the variable boldtext gets rejected. I defined it this way:

var boldtext = new GUIStyle (GUI.skin.label);
boldtext.fontStyle = FontStyle.Bold;

Am I using the style in a wrong way? Is there another to apply it? Somebody please help.

Hello there.

I use this:

EditorGUILayout.LabelField(“Inspector”, EditorStyles.boldLabel);

To get the desired result. Sorry if you already solved it, but well. :slight_smile:

Good luck!

In some cases you may want to change only a specific word or sentence, so you just need to make your text like that:

sb.Append("<size=10> <color=yellow><b>WARNING: </b></color> Some text here</size>");

In this case my style font size is 8, so this text will be a bit bigger then the other lines, the word WARNING will be written in yellow and bold and ‘Some text here’ is the default color.

For more details check:
https://docs.unity3d.com/Manual/StyledText.html