UI images color change ignores color selection in the edito

I have a list of elements that change color on hover

9244791--1292289--upload_2023-8-23_18-27-56.png

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

9244791--1292316--upload_2023-8-23_18-32-8.png

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

Try changing ui_panel.material.color. Just a thought.

Also try setting color alpha explicitly to 1f (4th parameter).

You never set the ui_panel.color to color_default. At least not in the provided code.