@@ -2779,6 +2779,8 @@ private void RefreshBuild()
2779
2779
[ NonSerialized ] private bool initDone ;
2780
2780
[ NonSerialized ] private bool buildReportInitDone ;
2781
2781
2782
+ [ SerializeField ] private bool firstRefresh = true ;
2783
+
2782
2784
[ SerializeField ] private MessageCategoryList masterList ;
2783
2785
2784
2786
[ SerializeField ] private MessageCategory general ;
@@ -2882,7 +2884,11 @@ private void Refresh()
2882
2884
2883
2885
CheckTime . Stop ( ) ;
2884
2886
2885
- if ( CheckTime . ElapsedMilliseconds >= 500 )
2887
+ if ( firstRefresh )
2888
+ {
2889
+ firstRefresh = false ;
2890
+ }
2891
+ else if ( CheckTime . ElapsedMilliseconds >= 500 )
2886
2892
{
2887
2893
autoRecheck = false ;
2888
2894
}
@@ -2924,6 +2930,10 @@ private enum ProjectType
2924
2930
}
2925
2931
2926
2932
private ProjectType projectType = ProjectType . NotDetected ;
2933
+
2934
+ // This is used to delay when the first scene check happens since for some reason
2935
+ // doing it too early in Unity 2022 causes noticeable lag especially in bigger scenes
2936
+ private static readonly Stopwatch InitializationDelayTimer = new ( ) ;
2927
2937
2928
2938
private void OnGUI ( )
2929
2939
{
@@ -2932,7 +2942,19 @@ private void OnGUI()
2932
2942
if ( current . type == EventType . Layout )
2933
2943
{
2934
2944
InitWhenNeeded ( ) ;
2935
- Refresh ( ) ;
2945
+ if ( ! firstRefresh )
2946
+ {
2947
+ Refresh ( ) ;
2948
+ }
2949
+ else
2950
+ {
2951
+ InitializationDelayTimer . Start ( ) ;
2952
+ if ( InitializationDelayTimer . ElapsedMilliseconds >= 500 )
2953
+ {
2954
+ InitializationDelayTimer . Stop ( ) ;
2955
+ Refresh ( ) ;
2956
+ }
2957
+ }
2936
2958
}
2937
2959
2938
2960
DrawBuildReportOverviews ( current ) ;
@@ -3024,6 +3046,14 @@ private void MessagesTab()
3024
3046
3025
3047
GUILayout . FlexibleSpace ( ) ;
3026
3048
}
3049
+ else if ( firstRefresh )
3050
+ {
3051
+ GUILayout . FlexibleSpace ( ) ;
3052
+
3053
+ EditorGUILayout . LabelField ( "Loading..." , Styles . CenteredLabel , GUILayout . ExpandWidth ( true ) , GUILayout . Height ( 20 ) ) ;
3054
+
3055
+ GUILayout . FlexibleSpace ( ) ;
3056
+ }
3027
3057
else
3028
3058
{
3029
3059
if ( ! autoRecheck && GUILayout . Button ( "Refresh" ) )
0 commit comments