StyleSheet

class in UnityEngine.UIElements

Switch to Manual

Description

Style sheets are applied to visual elements in order to control the layout and visual appearance of the user interface.

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.

using UnityEngine.UIElements;
using UnityEditor;

public class MyEditorWindow : EditorWindow { void OnEnable() { rootVisualElement.styleSheets.Add(AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/styles.uss")); } }

Variables

contentHashA hash value computed from the stylesheet content.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961