From 8d18515a4a768146e81418747d7eca3e1de6bef4 Mon Sep 17 00:00:00 2001 From: Simon Jackson Date: Sat, 4 Feb 2023 11:22:31 +0000 Subject: [PATCH] The BIG Unity 2022 Text reorganisation --- .../Controls/ColorPicker/ColorLabel.cs | 18 ++++- .../Controls/ComboBox/AutoCompleteComboBox.cs | 5 +- Runtime/Scripts/Controls/ComboBox/ComboBox.cs | 5 +- .../ReorderableList/ReorderableListDebug.cs | 4 + Runtime/Scripts/Controls/Segment.cs | 6 +- .../SelectionBox/ExampleSelectable.cs | 10 ++- Runtime/Scripts/Controls/TextPic.cs | 29 +++++-- Runtime/Scripts/Effects/BestFitOutline.cs | 3 + Runtime/Scripts/Effects/CurlyUI/CUIText.cs | 10 +++ Runtime/Scripts/Effects/CurvedText.cs | 7 +- Runtime/Scripts/Effects/CylinderText.cs | 7 +- Runtime/Scripts/Effects/LetterSpacing.cs | 77 +++++++++++++------ Runtime/Scripts/Effects/MonoSpacing.cs | 64 +++++++++++---- Runtime/Scripts/Effects/NicerOutline.cs | 5 +- Runtime/Scripts/Effects/SoftMaskScript.cs | 8 +- .../Scripts/Layout/UIHorizontalScroller.cs | 4 +- Runtime/Scripts/Layout/UIVerticalScroller.cs | 4 +- Runtime/Scripts/ToolTips/HoverTooltip.cs | 4 + Runtime/Scripts/ToolTips/ToolTip.cs | 8 ++ Runtime/Scripts/Utilities/PPIViewer.cs | 14 +++- .../ResetSelectableHighlight.cs.meta | 11 +++ 21 files changed, 239 insertions(+), 64 deletions(-) create mode 100644 Runtime/Scripts/Utilities/ResetSelectableHighlight.cs.meta diff --git a/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs b/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs index 0b92364..74d156e 100644 --- a/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs +++ b/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs @@ -5,7 +5,11 @@ namespace UnityEngine.UI.Extensions.ColorPicker { +#if UNITY_2022_1_OR_NEWER + [RequireComponent(typeof(TMPro.TMP_Text))] +#else [RequireComponent(typeof(Text))] +#endif public class ColorLabel : MonoBehaviour { public ColorPickerControl picker; @@ -18,12 +22,18 @@ namespace UnityEngine.UI.Extensions.ColorPicker public int precision = 0; +#if UNITY_2022_1_OR_NEWER + private TMPro.TMP_Text label; +#else private Text label; - +#endif private void Awake() { +#if UNITY_2022_1_OR_NEWER + label = GetComponent(); +#else label = GetComponent(); - +#endif } private void OnEnable() @@ -47,7 +57,11 @@ namespace UnityEngine.UI.Extensions.ColorPicker #if UNITY_EDITOR private void OnValidate() { +#if UNITY_2022_1_OR_NEWER + label = GetComponent(); +#else label = GetComponent(); +#endif UpdateValue(); } #endif diff --git a/Runtime/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs b/Runtime/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs index acab967..889ea54 100644 --- a/Runtime/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs +++ b/Runtime/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs @@ -299,8 +299,11 @@ namespace UnityEngine.UI.Extensions if (i < AvailableOptions.Count) { itemObjs[i].name = "Item " + i + " " + _panelItems[i]; +#if UNITY_2022_1_OR_NEWER + itemObjs[i].transform.Find("Text").GetComponent().text = AvailableOptions[i]; //set the text value +#else itemObjs[i].transform.Find("Text").GetComponent().text = AvailableOptions[i]; //set the text value - +#endif Button itemBtn = itemObjs[i].GetComponent