I have a list of elements that change color on hover
i want to select the color in the editor, and apply it on hover
public Image ui_panel;
public Color color_default;
[SerializeField] private Color color_hover = new(1f, 1f, 1f);
void Start()
{
color_default = new(0.3f, 0.3f, 0.3f);
}
public void OnPointerEnter(PointerEventData eventData)
{
ui_panel.color = color_hover;
}
in the editor
for some reason, color_default and color_hover always comes out black.
only when i overwrite it on start(), does it change color
void Start()
{
color_default = new(0.3f, 0.3f, 0.3f);
}
i’ve tried public, private serializedField, setting value as new. Setting value in the editor or in the field declaration ( new Color() or Color.red ) always produces black. Only when i set the value at runtime does it work