Version: 2018.3 (switch to 2019.1)
LanguageEnglish
  • C#
Experimental: this API is experimental and might be changed or removed in the future.

IStyle

interface in UnityEngine.Experimental.UIElements

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

This interface provides access to a VisualElement style data.

Reading properties from this object will read from the shared copy of style data, if multiple elements match the same USS rules. When writing to any of the properties the target element will start owning its own style data and stop using the shared copy. Writing to a property will mask the value coming from USS with the provided value however other properties will still match the values from USS.

Properties

alignContentAlignment of the whole area of children on the cross axis if they span over multiple lines in this container.
alignItemsAlignment of children on the cross axis of this container.
alignSelfSimilar to align-items, but only for this specific element.
backgroundColorBackground color to paint in the element's box.
backgroundImageBackground image to paint in the element's box.
backgroundScaleModeBackground image scaling in the element's box.
borderBottomLeftRadiusThis is the radius of the bottom-left corner when a rounded rectangle is drawn in the element's box.
borderBottomRightRadiusThis is the radius of the bottom-right corner when a rounded rectangle is drawn in the element's box.
borderBottomWidthSpace reserved for the bottom edge of the border during the layout phase.
borderColorColor of the border to paint inside the element's box.
borderLeftWidthSpace reserved for the left edge of the border during the layout phase.
borderRadiusThis is the radius of every corner when a rounded rectangle is drawn in the element's box.
borderRightWidthSpace reserved for the right edge of the border during the layout phase.
borderTopLeftRadiusThis is the radius of the top-left corner when a rounded rectangle is drawn in the element's box.
borderTopRightRadiusThis is the radius of the top-right corner when a rounded rectangle is drawn in the element's box.
borderTopWidthSpace reserved for the top edge of the border during the layout phase.
colorColor to use when drawing the text of an element.
cursorMouse cursor to display when the mouse pointer is over an element.
flexRation of this element in its parent during the layout phase.
flexBasisInitial main size of a flex item, on the main flex axis. The final layout mught be smaller or larger, according to the flex shrinking and growing determined by the flex property.
flexDirectionDirection of the main axis to layout children in a container.
flexGrowSpecifies how much the item will grow relative to the rest of the flexible items inside the same container.
flexShrinkSpecifies how the item will shrink relative to the rest of the flexible items inside the same container.
flexWrapPlacement of children over multiple lines if not enough space is available in this container.
fontFont to draw the element's text.
fontSizeFont size to draw the element's text.
fontStyleAndWeightFont style and weight (normal, bold, italic) to draw the element's text.
heightFixed height of an element for the layout.
justifyContentJustification of children on the main axis of this container.
marginBottomSpace reserved for the bottom edge of the margin during the layout phase.
marginLeftSpace reserved for the left edge of the margin during the layout phase.
marginRightSpace reserved for the right edge of the margin during the layout phase.
marginTopSpace reserved for the top edge of the margin during the layout phase.
maxHeightMaximum height for an element, when it is flexible or measures its own size.
maxWidthMaximum width for an element, when it is flexible or measures its own size.
minHeightMinimum height for an element, when it is flexible or measures its own size.
minWidthMinimum height for an element, when it is flexible or measures its own size.
paddingBottomSpace reserved for the bottom edge of the padding during the layout phase.
paddingLeftSpace reserved for the left edge of the padding during the layout phase.
paddingRightSpace reserved for the right edge of the padding during the layout phase.
paddingTopSpace reserved for the top edge of the padding during the layout phase.
positionBottomBottom distance from the element's box during layout.
positionLeftLeft distance from the element's box during layout.
positionRightRight distance from the element's box during layout.
positionTopTop distance from the element's box during layout.
positionTypeElement's positioning in its parent container.
sliceBottomSize of the 9-slice's bottom edge when painting an element's background image.
sliceLeftSize of the 9-slice's left edge when painting an element's background image.
sliceRightSize of the 9-slice's right edge when painting an element's background image.
sliceTopSize of the 9-slice's top edge when painting an element's background image.
textClippingClipping if the text does not fit in the element's box.
unityTextAlignHorizontal and vertical text alignment in the element's box.
visibilitySpecifies whether or not an element is visible.
widthFixed width of an element for the layout.
wordWrapWord wrapping over multiple lines if not enough space is available to draw the text of an element.
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答