@@ -121,9 +121,11 @@ private void PutPropertiesForObject<T>(List<T> Configs) where T : ScriptableObje
121121 {
122122 // Show the name of each property as a label
123123 EditorGUILayout . LabelField ( property . name , GUILayout . MinWidth ( PropertyMinWidth ) ) ;
124- float height = EditorGUI . GetPropertyHeight ( property , GUIContent . none ) + PropertySpace ;
125- height -= EditorGUIUtility . singleLineHeight ;
126- GUILayout . Space ( height ) ;
124+
125+ // if any property is bigger than expected this will calculate extra space needed (ex: array properties can expand)
126+ if ( property . isExpanded )
127+ GUILayout . Space ( CalculatePropertyHeight ( Configs , property ) - EditorGUIUtility . singleLineHeight ) ;
128+ GUILayout . Space ( PropertySpace ) ;
127129 }
128130 ShouldNext = property . NextVisible ( false ) ; // Move to the next property, skipping nested children
129131 }
@@ -180,6 +182,12 @@ private void PutPropertiesForObject<T>(List<T> Configs) where T : ScriptableObje
180182 break ;
181183 default :
182184 EditorGUILayout . PropertyField ( property , GUIContent . none , true , GUIL_DefaultOptions ) ;
185+ if ( property . isExpanded )
186+ {
187+ float extraSpace = CalculatePropertyHeight ( Configs , property ) ;
188+ extraSpace -= EditorGUI . GetPropertyHeight ( property ) ;
189+ GUILayout . Space ( extraSpace ) ;
190+ }
183191 break ;
184192 // Additional cases can be added here to support more property types
185193 }
@@ -206,6 +214,26 @@ private void PutPropertiesForObject<T>(List<T> Configs) where T : ScriptableObje
206214 GroupScriptableObjectsByType ( ) ;
207215 }
208216 }
217+
218+ public static float CalculatePropertyHeight < T > ( List < T > configs , SerializedProperty property ) where T : ScriptableObject
219+ {
220+ float maxHeight = 0f ;
221+
222+ foreach ( var config in configs )
223+ {
224+ SerializedObject serializedObject = new SerializedObject ( config ) ;
225+ SerializedProperty targetProperty = serializedObject . FindProperty ( property . propertyPath ) ;
226+
227+ if ( targetProperty != null )
228+ {
229+ float height = EditorGUI . GetPropertyHeight ( targetProperty , true ) ;
230+ maxHeight = Mathf . Max ( maxHeight , height ) ;
231+ }
232+ }
233+
234+ return maxHeight ;
235+ }
236+
209237}
210238
211239// Custom Popup Window for Config Type Selection
0 commit comments