diff --git a/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs b/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs index 74d156e..5582ca8 100644 --- a/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs +++ b/Runtime/Scripts/Controls/ColorPicker/ColorLabel.cs @@ -34,6 +34,10 @@ namespace UnityEngine.UI.Extensions.ColorPicker #else label = GetComponent(); #endif + if (!label) + { + Debug.LogError($"{gameObject.name} does not have a Text component assigned for the {nameof(ColorLabel)}"); + } } private void OnEnable() @@ -54,18 +58,6 @@ 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 - private void ColorChanged(Color color) { UpdateValue();