@@ -457,7 +457,10 @@ public void CutKeyboardFocus()
457457
458458 public void AppendElement ( )
459459 {
460- Index = ( List . arraySize += 1 ) - 1 ;
460+ var newSize = Size . intValue + 1 ;
461+ Size . intValue = newSize ;
462+ Index = newSize - 1 ;
463+
461464 if ( overrideNewElementCallback == null )
462465 {
463466 return ;
@@ -522,6 +525,7 @@ public virtual void DrawStandardFooter(Rect rect)
522525 //set button area rect
523526 rect = new Rect ( rect . xMax - Style . footerWidth , rect . y , Style . footerWidth , rect . height ) ;
524527
528+ var actionPerformed = false ;
525529 //set rect properties from style
526530 var buttonWidth = Style . footerButtonWidth ;
527531 var buttonHeight = Style . footerButtonHeight ;
@@ -531,7 +535,7 @@ public virtual void DrawStandardFooter(Rect rect)
531535 //set proper rect for each button
532536 var appendButtonRect = new Rect ( rect . xMin + margin , rect . y - padding , buttonWidth , buttonHeight ) ;
533537
534- EditorGUI . BeginDisabledGroup ( List . hasMultipleDifferentValues ) ;
538+ EditorGUI . BeginDisabledGroup ( Size . hasMultipleDifferentValues ) ;
535539 EditorGUI . BeginDisabledGroup ( onCanAppendCallback != null && ! onCanAppendCallback ( this ) ) ;
536540 if ( GUI . Button ( appendButtonRect , onAppendDropdownCallback != null
537541 ? Style . iconToolbarDropContent
@@ -551,9 +555,10 @@ public virtual void DrawStandardFooter(Rect rect)
551555 }
552556
553557 onChangedCallback ? . Invoke ( this ) ;
558+ actionPerformed = true ;
554559 }
555- EditorGUI . EndDisabledGroup ( ) ;
556560
561+ EditorGUI . EndDisabledGroup ( ) ;
557562 var removeButtonRect = new Rect ( rect . xMax - buttonWidth - margin , rect . y - padding , buttonWidth , buttonHeight ) ;
558563
559564 EditorGUI . BeginDisabledGroup ( ( onCanRemoveCallback != null && ! onCanRemoveCallback ( this ) || Index < 0 || Index >= Count ) ) ;
@@ -569,9 +574,17 @@ public virtual void DrawStandardFooter(Rect rect)
569574 }
570575
571576 onChangedCallback ? . Invoke ( this ) ;
577+ actionPerformed = true ;
572578 }
579+
573580 EditorGUI . EndDisabledGroup ( ) ;
574581 EditorGUI . EndDisabledGroup ( ) ;
582+
583+ if ( actionPerformed )
584+ {
585+ SerializedObject . ApplyModifiedProperties ( ) ;
586+ GUIUtility . ExitGUI ( ) ;
587+ }
575588 }
576589
577590 /// <summary>
0 commit comments