StyleSheet
Style sheets are applied to visual elements in order to control the layout and visual appearance of the user interface.
Read time 4 minutesLast updated 4 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: ScriptableObject
[HelpURL("UIE-USS")]public class StyleSheet : ScriptableObject
Remarks
The StyleSheet class holds the imported data of USS files in your project. Once loaded, a style sheet can be attached to a VisualElement object to affect the element itself and its descendants.
Examples
public class MyEditorWindow : EditorWindow{ void OnEnable() { rootVisualElement.styleSheets.Add(AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/styles.uss")); }}
Properties
Property | Description |
|---|---|
| contentHash | A hash value computed from the stylesheet content. |
| importedWithErrors | Whether there were errors encountered while importing the StyleSheet |
| importedWithWarnings | Whether there were warnings encountered while importing the StyleSheet |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |