[SOLVED] (C#) Custom Property Drawers: Label text not showing

Well I’m trying to get three arrays to display “linked” to each other.
The only thing is that the labels wont display text, but if I hover my mouse over them they do display a tooltip so they are there I guess.

Expectations:
5133806--507749--upload_2019-11-3_2-46-34.png
Picture of the property as it should be displayed in the editor. Text drawn with a graphics editor.

Reality:
5133806--507746--upload_2019-11-3_2-45-27.png
Picture of the property as it should be displayed in the editor, the labels display no text, but are stil present, for they do display a tooltip when the mouse hovers above them.

Without Property Drawers:
5133806--507752--upload_2019-11-3_2-47-37.png
The three arrays displayed separately, for they have no property drawers. “Information” is abbreviated ‘Ex’ in the property drawers example (for a trivial reason), while “Durations” is changed to ‘Time’.

And here is my current code:

// The class that stores the three arrays
public class MeshFrames : PropertyAttribute {
    public static readonly int INITIAL_SIZE = 3;

    [Tooltip("Mesh that will be displayed that frame.")]
    public Mesh[] values;

    [Tooltip("Duration in Relative Units of that particular frame.")]
    public uint[] durations;

    [Tooltip("An extra value linked to that frame.")]
    public float[] information;

    public MeshFrames() {
        values = new Mesh[INITIAL_SIZE];
        for (int i = 0; i < INITIAL_SIZE; i++) { values[i] = null; }

        durations = new uint[INITIAL_SIZE];
        for (int i = 0; i < INITIAL_SIZE; i++) { durations[i] = 1; }

        information = new float[INITIAL_SIZE];
        for (int i = 0; i < INITIAL_SIZE; i++) { information[i] = 0; }
    }
}

// The Property Drawer
[CustomPropertyDrawer(typeof(MeshFrames))]
public class SpriteFramesDrawer : PropertyDrawer {
    // Draw the property inside the given rect
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {

        // Obtaining the values from sprite arrays
        SerializedProperty arrayProp = property.FindPropertyRelative("values");
        SerializedProperty duratProp = property.FindPropertyRelative("durations");
        SerializedProperty inforProp = property.FindPropertyRelative("information");

        // This will display an Inspector Field for each array item
        for (int i = 0; i < arrayProp.arraySize; i++) {
            /// Getting this item's individual values
            SerializedProperty value = arrayProp.GetArrayElementAtIndex(i);
            SerializedProperty durat = duratProp.GetArrayElementAtIndex(i);
            SerializedProperty infor = inforProp.GetArrayElementAtIndex(i);

            /// Creating appropiate rects
            var valueRect =         new Rect(position.x                         , position.y + (16 * i), position.width - 130   , 15);
            var durationRect =      new Rect(position.x + position.width - 130  , position.y + (16 * i), 80                     , 15);
            var informationRect =   new Rect(position.x + position.width - 45   , position.y + (16 * i), 45                     , 15);

            /// Applying Rects
            GUIContent sampleGUIContent = new GUIContent();

            // The label of the mesh value is just its index.
            sampleGUIContent.text = i + ": ";
            EditorGUIUtility.labelWidth = 40;
            EditorGUI.PropertyField(valueRect, value, sampleGUIContent);

            // The label of the duration value is "Time: "
            sampleGUIContent.text = "Time: ";
            EditorGUIUtility.labelWidth = 40;
            EditorGUI.PropertyField(durationRect, durat, sampleGUIContent);

            // The label of the information value is "Ex: "
            sampleGUIContent.text = "Ex: ";
            EditorGUIUtility.labelWidth = 25;
            EditorGUI.PropertyField(informationRect, infor, sampleGUIContent);
        }
    }

    public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
        // The base height
        int baseHeight = 8;

        // Obtaining the length of the arrays (assuming they all have the same size)
        SerializedProperty arrayProp = property.FindPropertyRelative("values");

        // Calculating added height based on array sizes
        int addedHeight = arrayProp.arraySize * 16;

        // Returning the height of the property
        return baseHeight + addedHeight;
    }
}

And well, I tried restarting the editor, changing label sizes width numbers (Maybe it was too small?) but it just doesnt show. Any ideas on what to try?

All right so, honestly I’m not that experienced with Property Drawers and I was just visiting this after a 8 month hiatus, so I just looked at my old examples and fount two snippets of code that seem to make it work, let me point them out for whoever may have a similar problem (Note the only changes were made to the CustomPropertyDrawer class):

Reality
5133818--507755--upload_2019-11-3_3-13-8.png
How the property, now succesfully, displays in the editor.

Lines 8-22 and 61-65*

[CustomPropertyDrawer(typeof(MeshFrames))]
public class SpriteFramesDrawer : PropertyDrawer {

    // Draw the property inside the given rect
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {

        #region precode for labels i guess
        // For this particular purpose, the LABEL text must be CLEAR. (?)
        label.text = "";

        // Using BeginProperty / EndProperty on the parent property means that (?)
        // prefab override logic works on the entire property. (?)
        EditorGUI.BeginProperty(position, label, property);

        // Draw label (?)
        position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

        // Don't make child fields be indented (?)
        var indent = EditorGUI.indentLevel;
        EditorGUI.indentLevel = 0;
        #endregion

        // Obtaining the values from sprite array
        SerializedProperty arrayProp = property.FindPropertyRelative("values");
        SerializedProperty duratProp = property.FindPropertyRelative("durations");
        SerializedProperty inforProp = property.FindPropertyRelative("information");

        // This will display an Inspector Field for each array item
        for (int i = 0; i < arrayProp.arraySize; i++) {

            /// Getting the sprite value
            SerializedProperty value = arrayProp.GetArrayElementAtIndex(i);
            SerializedProperty durat = duratProp.GetArrayElementAtIndex(i);
            SerializedProperty infor = inforProp.GetArrayElementAtIndex(i);

            /// Creating appropiate rects
            var valueRect =         new Rect(position.x                         , position.y + (16 * i), position.width - 130   , 15);
            var durationRect =      new Rect(position.x + position.width - 130  , position.y + (16 * i), 80                     , 15);
            var informationRect =   new Rect(position.x + position.width - 45   , position.y + (16 * i), 45                     , 15);

            /// Applying Rects
            GUIContent sampleGUIContent = new GUIContent();

            // The label of the mesh value is just its index.
            sampleGUIContent.text = i + ": ";
            EditorGUIUtility.labelWidth = 40;
            EditorGUI.PropertyField(valueRect, value, sampleGUIContent);

            // The label of the duration value is "Time: "
            sampleGUIContent.text = "Time: ";
            EditorGUIUtility.labelWidth = 40;
            EditorGUI.PropertyField(durationRect, durat, sampleGUIContent);

            // The label of the information value is "Ex: "
            sampleGUIContent.text = "Ex: ";
            EditorGUIUtility.labelWidth = 25;
            EditorGUI.PropertyField(informationRect, infor, sampleGUIContent);
        }

        #region postcode for labels I guess
        // Set indent back to what it was (?)
        EditorGUI.indentLevel = indent;
        EditorGUI.EndProperty();
        #endregion
    }

    public override float GetPropertyHeight (SerializedProperty property, GUIContent label) {
        // The Base Height
        int baseHeight = 8;

        // Obtaining the length of the arrays (assuming they all have the same size)
        SerializedProperty arrayProp = property.FindPropertyRelative("values");

        // Calculating added height based on array sizes
        int addedHeight = arrayProp.arraySize * 16;

        // Returning the height of the property
        return baseHeight + addedHeight;
    }
}

* The “(?)” at the comments of those added lines mean that I literally just copied and pasted them from my old code so they may not be accurate for this new purpose and I didn’t bother revising them.