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