Extend the UI Builder Inspector panel to show custom styles

Hello,
maybe I’m missing something, I’m just wondering what’s the best way to style custom elements with custom style properties.

I followed this guide: Unity - Manual: Create a custom style for a custom control

So far everything looks as expected, I’ve created a simple uss class to be able to set the custom styles for that element.

.custom-element-class {
    --gradient-from: white;
    --gradient-to: black;
}

I can also manually add these custom styles in the inlined style of the custom element, which is consistent to other styles.

My question is if it is possible to expose these custom styles to the UI Builder Inspector for editing. I can see the set values in the Matching Selectors section:

UI Builder Inspector screenshot

But those values are read-only.
The custom styles in the inlined style are not visible.
Are we really supposed to change the values by manually edit the uss files in the IDE?
Would be nice if there is a way to extend the UI Builder Inspector and be able to expose those custom styles to be edited.

Same for the uss class inspector, it’s only showing the default styles, but none of the custom ones.

USS class inspector

Hello!

We recently landed a variable editing section in the builder inspector, unfortunately, it’s in 6.1. Here’s the doc page: Unity - Manual: Manage USS variables in UI Builder

5 Likes

That is great news, any chance this will get backported to Unity 6.0?

Unfortunately, features generally don’t get backported.

@laila-chammaa
Does 6.1 also adds a way to set custom “–gradient-from” internal style from C#? Is this API coming soon?

That API will be available in an upcoming Unity version, stay tuned!

1 Like