From f9df103b98b4eda75596c81d28bd05f31470e4f5 Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Mon, 31 Aug 2020 06:46:55 +1000 Subject: [PATCH] Change FlowchartWindow Style caching Now forces expended values into the cached style repeatedly. In newer Unity UI we were seeing missing alignment and colour during caching --- .../Fungus/Scripts/Editor/FlowchartWindow.cs | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs index d546d916..d5a9b6bf 100644 --- a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs +++ b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs @@ -286,38 +286,39 @@ namespace Fungus.EditorUtils if (nodeStyle == null) { nodeStyle = new GUIStyle(); - // All block nodes use the same GUIStyle, but with a different background - nodeStyle.border = new RectOffset(HorizontalPad, HorizontalPad, VerticalPad, VerticalPad); - nodeStyle.padding = nodeStyle.border; - nodeStyle.contentOffset = Vector2.zero; - nodeStyle.alignment = TextAnchor.MiddleCenter; - nodeStyle.wordWrap = true; } + // All block nodes use the same GUIStyle, but with a different background + nodeStyle.border = new RectOffset(HorizontalPad, HorizontalPad, VerticalPad, VerticalPad); + nodeStyle.padding = nodeStyle.border; + nodeStyle.contentOffset = Vector2.zero; + nodeStyle.alignment = TextAnchor.MiddleCenter; + nodeStyle.wordWrap = true; + if (EditorStyles.helpBox != null && descriptionStyle == null) { descriptionStyle = new GUIStyle(EditorStyles.helpBox); - descriptionStyle.wordWrap = true; } + descriptionStyle.wordWrap = true; if (EditorStyles.whiteLabel != null && handlerStyle == null) { handlerStyle = new GUIStyle(EditorStyles.label); - handlerStyle.wordWrap = true; - handlerStyle.margin.top = 0; - handlerStyle.margin.bottom = 0; - handlerStyle.alignment = TextAnchor.MiddleCenter; } + handlerStyle.wordWrap = true; + handlerStyle.margin.top = 0; + handlerStyle.margin.bottom = 0; + handlerStyle.alignment = TextAnchor.MiddleCenter; - if(blockSearchPopupNormalStyle == null || blockSearchPopupSelectedStyle == null) + if (blockSearchPopupNormalStyle == null || blockSearchPopupSelectedStyle == null) { blockSearchPopupNormalStyle = new GUIStyle(GUI.skin.FindStyle("MenuItem")); - blockSearchPopupNormalStyle.padding = new RectOffset(8, 0, 0, 0); - blockSearchPopupNormalStyle.imagePosition = ImagePosition.ImageLeft; - blockSearchPopupSelectedStyle = new GUIStyle(blockSearchPopupNormalStyle); - blockSearchPopupSelectedStyle.normal = blockSearchPopupSelectedStyle.hover; - blockSearchPopupNormalStyle.hover = blockSearchPopupNormalStyle.normal; } + blockSearchPopupNormalStyle.padding = new RectOffset(8, 0, 0, 0); + blockSearchPopupNormalStyle.imagePosition = ImagePosition.ImageLeft; + blockSearchPopupSelectedStyle = new GUIStyle(blockSearchPopupNormalStyle); + blockSearchPopupSelectedStyle.normal = blockSearchPopupSelectedStyle.hover; + blockSearchPopupNormalStyle.hover = blockSearchPopupNormalStyle.normal; } protected virtual void OnDisable()