@@ -45,6 +45,8 @@ public class DebugLogRecycledListView : MonoBehaviour
4545
4646 private bool isCollapseOn = false ;
4747
48+ private bool viewportSizeChanged ;
49+
4850 // Current indices of debug entries shown on screen
4951 private int currentTopIndex = - 1 , currentBottomIndex = - 1 ;
5052
@@ -293,25 +295,36 @@ private int FindIndexOfLogEntryInReverseDirection( DebugLogEntry logEntry, int s
293295 return - 1 ;
294296 }
295297
296- // Log window's width has changed, update the expanded (currently selected) log's height
297- public void OnViewportWidthChanged ( )
298+ private void OnRectTransformDimensionsChange ( )
299+ {
300+ viewportSizeChanged = true ;
301+ }
302+
303+ private void LateUpdate ( )
304+ {
305+ if ( viewportSizeChanged )
306+ {
307+ viewportSizeChanged = false ;
308+ OnViewportSizeChanged ( ) ;
309+ }
310+ }
311+
312+ private void OnViewportSizeChanged ( )
298313 {
299- if ( indexOfSelectedLogEntry >= entriesToShow . Count )
300- return ;
314+ if ( indexOfSelectedLogEntry >= entriesToShow . Count )
315+ {
316+ UpdateItemsInTheList ( false ) ;
317+ return ;
318+ }
301319
320+ // Update the expanded (currently selected) log's height
302321 CalculateSelectedLogEntryHeight ( ) ;
303322 CalculateContentHeight ( ) ;
304323 UpdateItemsInTheList ( true ) ;
305324
306325 manager . ValidateScrollPosition ( ) ;
307326 }
308327
309- // Log window's height has changed, update the list
310- public void OnViewportHeightChanged ( )
311- {
312- UpdateItemsInTheList ( false ) ;
313- }
314-
315328 private void CalculateContentHeight ( )
316329 {
317330 float newHeight = Mathf . Max ( 1f , entriesToShow . Count * logItemHeight ) ;
0 commit comments