- Home /
Why is my property drawer not drawing on the next line?
No matter what, my "Listener" field is always displayed on the same line as the label, but I want it to be drawn on the next line.`enter code here`
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return base.GetPropertyHeight(property, label) + 20f;
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
_prop = property;
Drawer.DrawDefaultPropertyLabel(property, ref position, ref label);
// Drawer.NextLine(ref position);
position.width *= .25f;
position.y += 16f;
position.height += 18f;
//EditorGUI.LabelField(position, "re");
DrawListener(position, GUIContent.none);
EditorGUI.EndProperty();
}
public void DrawListener(Rect position, GUIContent label)
{
var listener = _prop.FindPropertyRelative("_listener");
EditorGUI.PropertyField(position, listener, GUIContent.none);
}
Answer by supremegrandruler · Dec 14, 2015 at 02:08 AM
Solved it. Basically I had the above code in 2 different classes with the same name. One was in the normal Asset folder and the other in the Editor folder. I was working on the one in the Asset folder which is why nothing was happening.
Your answer
Follow this Question
Related Questions
EditorGUI.Foldout -- Cannot interact with contents! 1 Answer
GetPropertyHeight infinite recursion on drawer 1 Answer
Using EditorGUI.ObjectField in PropertyDrawer 0 Answers
EditorGUI.Foldout consumes click so GUI.Button doesnt work when inside of foldout region. 1 Answer
How to get width at which Inspector does line breaks (for Vectors) 1 Answer