- Home /
This question was
closed Apr 13, 2021 at 06:57 AM by
Vstory for the following reason:
The question is answered, right answer was accepted
Question by
Vstory · Apr 12, 2021 at 09:00 PM ·
issueheightpropertydrawer
ReorderableList do not resize a height of each element(property drawer)
In 2020, the collection is displayed in the inspector view in the form of a Reorderable List.
The drag item works normally for the last element.
However, the rest of the elements do not work even when the item is dragged, so the height cannot be adjusted.
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
var targetObj = property.FindPropertyRelative(targetObjName).objectReferenceValue;
// only last element works.
Debug.Log(property.FindPropertyRelative(targetObjName).propertyPath);
return base.GetPropertyHeight(property, label) +
(targetObj != null ? lineHeight + verticalSpacing : 0);
}
cf. Check Reference is a custom property class that inherits PropertyDrawer.
issue.jpg
(56.7 kB)
Comment
Best Answer
Answer by Vstory · Apr 13, 2021 at 06:51 AM
EditorGUI.BeginChangeCheck()
if (EditorGUI.EndChangeCheck()) { property.serializedObject.ApplyModifiedProperties(); }
After deleting the above code, it works normally.