ui
[UI Toolkit] Missing border-style Property Support in USS
Solution
Unity 2021.x - Unity 6.3.x
Published 21 days ago
Unity style sheets (USS) do not currently support the border-style property used in standard CSS for defining dashed, dotted, or double borders. This limitation prevents developers from styling VisualElement borders beyond solid lines through simple style definitions.
While properties for width, color, and radius exist, the logic for pattern-based strokes is absent from the UI Toolkit rendering pipeline.
Quick-Fix
The border-style property is not supported in USS. Advanced border appearances must be implemented using 9-sliced VectorImage assets or custom geometry.
/* Example of applying a custom border-style via sliced background image in USS */
.dashed-border-container {
/* Use a 9-sliced SVG/VectorImage instead of border-style */
background-image: url('project:/Assets/UI/Textures/DashedBorder.svg');
/* Define slicing values to protect the dashed corners */
-unity-background-image-tint-color: white;
-unity-slice-left: 10;
-unity-slice-top: 10;
-unity-slice-right: 10;
-unity-slice-bottom: 10;
/* Ensure standard borders are disabled */
border-left-width: 0px;
border-right-width: 0px;
border-top-width: 0px;
border-bottom-width: 0px;
}
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
[UI Toolkit] Customize Slider Fill Color via USS Selectors[UI Toolkit] Animate Tiled Background Scrolling[UI Toolkit] Master Percentage Binding for Responsive Layouts
Content inspired by a Unity discussion post.