10
10
using UnityEngine ;
11
11
using UnityEngine . Assertions ;
12
12
using UnityEngine . Rendering ;
13
+ using PackageInfo = UnityEditor . PackageManager . PackageInfo ;
13
14
14
15
namespace UnityEditor . Rendering
15
16
{
@@ -582,6 +583,7 @@ public class Styles
582
583
public readonly Color skinBackgroundColor ;
583
584
584
585
public static GUIStyle centeredLeft = new GUIStyle ( EditorStyles . label ) { alignment = TextAnchor . MiddleLeft } ;
586
+ public static GUIStyle centeredLeftAlternate = new GUIStyle ( EditorStyles . label ) { alignment = TextAnchor . MiddleLeft } ;
585
587
public static float singleRowHeight = EditorGUIUtility . singleLineHeight + EditorGUIUtility . standardVerticalSpacing ;
586
588
587
589
public static int foldoutColumnWidth = 70 ;
@@ -593,6 +595,12 @@ public Styles()
593
595
Color backgroundColorDarkSkin = new Color32 ( 38 , 38 , 38 , 128 ) ;
594
596
Color backgroundColorLightSkin = new Color32 ( 128 , 128 , 128 , 96 ) ;
595
597
598
+ centeredLeftAlternate . normal . background = CoreEditorUtils . CreateColoredTexture2D (
599
+ EditorGUIUtility . isProSkin
600
+ ? new Color ( 63 / 255.0f , 63 / 255.0f , 63 / 255.0f , 255 / 255.0f )
601
+ : new Color ( 202 / 255.0f , 202 / 255.0f , 202 / 255.0f , 255 / 255.0f ) ,
602
+ "centeredLeftAlternate Background" ) ;
603
+
596
604
sectionScrollView = new GUIStyle ( sectionScrollView ) ;
597
605
sectionScrollView . overflow . bottom += 1 ;
598
606
@@ -604,6 +612,15 @@ public Styles()
604
612
sectionHeader . margin . left += 1 ;
605
613
sectionHeader . normal . textColor = EditorGUIUtility . isProSkin ? textColorDarkSkin : textColorLightSkin ;
606
614
skinBackgroundColor = EditorGUIUtility . isProSkin ? backgroundColorDarkSkin : backgroundColorLightSkin ;
615
+
616
+ // Make sure that textures are unloaded on domain reloads.
617
+ void OnBeforeAssemblyReload ( )
618
+ {
619
+ UnityEngine . Object . DestroyImmediate ( centeredLeftAlternate . normal . background ) ;
620
+ AssemblyReloadEvents . beforeAssemblyReload -= OnBeforeAssemblyReload ;
621
+ }
622
+
623
+ AssemblyReloadEvents . beforeAssemblyReload += OnBeforeAssemblyReload ;
607
624
}
608
625
}
609
626
0 commit comments