Remove editor validation and add error checking for the ColorLabel component
parent
8d18515a4a
commit
b59f5132c3
|
@ -34,6 +34,10 @@ namespace UnityEngine.UI.Extensions.ColorPicker
|
|||
#else
|
||||
label = GetComponent<Text>();
|
||||
#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<TMPro.TMP_Text>();
|
||||
#else
|
||||
label = GetComponent<Text>();
|
||||
#endif
|
||||
UpdateValue();
|
||||
}
|
||||
#endif
|
||||
|
||||
private void ColorChanged(Color color)
|
||||
{
|
||||
UpdateValue();
|
||||
|
|
Loading…
Reference in New Issue