UIToolkit UIElements, how to access the hover uss style from code?
Asked Answered
O

1

0

Hi, I want to do UI Toolkit Editor Window from pure code without USS/Style sheets/UXML/other wierd things. I simply prefer code.

How do I access in Code the uss hover property ?

.quicktool-button-icon:hover {
    opacity: 1;
}

I can’t find these psudo classes, in code.

any help appreciated

Osteopath answered 8/1 at 21:41 Comment(0)
O
0

I have found a way to do it, 1 hour after posting the question

Button button = new Button();
button.RegisterCallback<MouseOverEvent>((type) =>
{
    buttonIcon.style.opacity = 1f;
});

button.RegisterCallback<MouseOutEvent>((type) =>
{
    buttonIcon.style.opacity = 0.5f;
});
Osteopath answered 8/1 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.