Beispiel #1
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        position.x -= 10;
        Rect rect = new Rect(position);

        rect.width = 20;
        bool remove = false;

        if (GUI.Button(rect, ReorderableList.IconContent("Toolbar Minus", "Remove point"), "label"))
        {
            remove = true;
        }
        position.x += 10;
        EditorGUI.PropertyField(position, property, GUIContent.none);
        if (remove)
        {
            SerializedProperty arrayProp = property.serializedObject.FindProperty(property.propertyPath.Split('.')[0]);
            arrayProp.DeleteArrayElementAtIndex(GetIndex(property));
        }
    }