static CoreEditorStyles() { smallTickbox = new GUIStyle("ShurikenToggle"); smallMixedTickbox = new GUIStyle("ShurikenToggleMixed"); var transparentTexture = new Texture2D(1, 1, GraphicsFormat.R8G8B8A8_SRGB, TextureCreationFlags.None); transparentTexture.SetPixel(0, 0, Color.clear); transparentTexture.Apply(); miniLabelButton = new GUIStyle(EditorStyles.miniLabel); miniLabelButton.normal = new GUIStyleState { background = transparentTexture, scaledBackgrounds = null, textColor = Color.grey }; var activeState = new GUIStyleState { background = transparentTexture, scaledBackgrounds = null, textColor = Color.white }; miniLabelButton.active = activeState; miniLabelButton.onNormal = activeState; miniLabelButton.onActive = activeState; paneOptionsIconDark = CoreEditorUtils.LoadIcon("Builtin Skins/DarkSkin/Images", "pane options", ".png"); paneOptionsIconLight = CoreEditorUtils.LoadIcon("Builtin Skins/LightSkin/Images", "pane options", ".png"); m_LightThemeBackgroundColor = new Color(0.7843138f, 0.7843138f, 0.7843138f, 1.0f); m_LightThemeBackgroundHighlightColor = new Color32(174, 174, 174, 255); m_DarkThemeBackgroundColor = new Color(0.2196079f, 0.2196079f, 0.2196079f, 1.0f); m_DarkThemeBackgroundHighlightColor = new Color32(77, 77, 77, 255); additionalPropertiesHighlightStyle = new GUIStyle(); additionalPropertiesHighlightStyle.normal.background = Texture2D.whiteTexture; var contextTooltip = ""; // To be defined (see with UX) contextMenuIcon = new GUIContent(paneOptionsIcon, contextTooltip); contextMenuStyle = new GUIStyle("IconButton"); iconHelp = new GUIContent(EditorGUIUtility.FindTexture("_Help")); iconHelpStyle = GUI.skin.FindStyle("IconButton") ?? EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("IconButton"); }
// Note: We do not use the editor resource loading mechanism for light unit icons because we need to skin the icon correctly for the editor theme. // Maybe the resource reloader can be improved to support icon loading (thus supporting skinning)? static Texture2D GetLightUnitIcon(string name) { return(CoreEditorUtils.LoadIcon(@"Packages/com.unity.render-pipelines.core/Editor/Lighting/Icons/LightUnitIcons", name, ".png")); }
static CoreEditorStyles() { smallTickbox = new GUIStyle("ShurikenToggle"); smallMixedTickbox = new GUIStyle("ShurikenToggleMixed"); var transparentTexture = new Texture2D(1, 1, GraphicsFormat.R8G8B8A8_SRGB, TextureCreationFlags.None) { name = "transparent" }; transparentTexture.SetPixel(0, 0, Color.clear); transparentTexture.Apply(); miniLabelButton = new GUIStyle(EditorStyles.miniLabel) { normal = new GUIStyleState { background = transparentTexture, scaledBackgrounds = null, textColor = Color.grey } }; var activeState = new GUIStyleState { background = transparentTexture, scaledBackgrounds = null, textColor = Color.white }; miniLabelButton.active = activeState; miniLabelButton.onNormal = activeState; miniLabelButton.onActive = activeState; paneOptionsIconDark = CoreEditorUtils.LoadIcon("Builtin Skins/DarkSkin/Images", "pane options", ".png"); paneOptionsIconDark.name = "pane options dark skin"; paneOptionsIconLight = CoreEditorUtils.LoadIcon("Builtin Skins/LightSkin/Images", "pane options", ".png"); paneOptionsIconLight.name = "pane options light skin"; m_LightThemeBackgroundColor = new Color(0.7843138f, 0.7843138f, 0.7843138f, 1.0f); m_LightThemeBackgroundHighlightColor = new Color32(174, 174, 174, 255); m_DarkThemeBackgroundColor = new Color(0.2196079f, 0.2196079f, 0.2196079f, 1.0f); m_DarkThemeBackgroundHighlightColor = new Color32(77, 77, 77, 255); additionalPropertiesHighlightStyle = new GUIStyle { normal = { background = Texture2D.whiteTexture } }; const string contextTooltip = ""; // To be defined (see with UX) contextMenuIcon = new GUIContent(paneOptionsIcon, contextTooltip); contextMenuStyle = new GUIStyle("IconButton"); redTexture = CoreEditorUtils.CreateColoredTexture2D(Color.red, "Red 1x1"); greenTexture = CoreEditorUtils.CreateColoredTexture2D(Color.green, "Green 1x1"); blueTexture = CoreEditorUtils.CreateColoredTexture2D(Color.blue, "Blue 1x1"); iconHelp = EditorGUIUtility.FindTexture("_Help"); iconWarn = EditorGUIUtility.FindTexture("console.warnicon"); iconFail = EditorGUIUtility.FindTexture("console.erroricon"); iconSuccess = EditorGUIUtility.FindTexture("TestPassed"); iconPending = EditorGUIUtility.FindTexture("Toolbar Minus"); globalSettingsIcon = EditorGUIUtility.FindTexture("ScriptableObject Icon"); // Make sure that textures are unloaded on domain reloads. void OnBeforeAssemblyReload() { Object.DestroyImmediate(redTexture); Object.DestroyImmediate(greenTexture); Object.DestroyImmediate(blueTexture); Object.DestroyImmediate(transparentTexture); AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload; } AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload; }