EditorGUI.PrefixLabel broken?

So I’m following along with a tutorial (Hex Map 1) and am currently on part 4.1 where we make a custom property drawer and for some reason mine just isn’t displaying the label no matter what I do. It’s half working because the positioning is correct for the information afterwards, but instead of displaying the name of the property, it’s just blank.

Here’s the code for the property drawer, it’s exactly the same as in the tutorial and it worked just fine for him.

using UnityEngine;
using UnityEditor;

[CustomPropertyDrawer(typeof(HexCoordinates))]
public class HexCoordinatesDrawer : PropertyDrawer
{
	public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
	{
		HexCoordinates coordinates = new HexCoordinates(property.FindPropertyRelative("x").intValue,
			property.FindPropertyRelative("z").intValue);

		position = EditorGUI.PrefixLabel(position, label);
		GUI.Label(position, coordinates.ToString());
	}
}

The tutorial is a few years old at this point, so I wouldn’t be surprised if this is a new bug or it’s been deprecated, but even according to the current documentation what I’m doing should work. I tried playing around with some things and confirmed that label.text is “Coordinates” which is what I expect to see instead of nothing. Any ideas? I’m using Unity 2021.1.19f1

Adding EditorGUI.LabelField( position, label ); before updating position helped me (Unity 2020.3.23):

EditorGUI.LabelField( position, label );
position = EditorGUI.PrefixLabel(position, label);
GUI.Label(position, coordinates.ToString());

The EditorGUI.PrefixLabel and GUI.Label API calls can be combined into a single API call using EditorGUI.LabelField (Unity 2021.3.8f1):

EditorGUI.LabelField(position, label.text, coordinates.ToString());

API Reference Unity - Scripting API: EditorGUI.LabelField

Same manual, same chapter, same concern :slight_smile: spent a while looking how to set LabelText.text explicilty, no luck yet. Unity 2020.3.20f1 :slight_smile: