您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
32 行
851 B
32 行
851 B
using UnityEditor;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace Unity.Services.Core.Editor
|
|
{
|
|
static class VisualElementHelper
|
|
{
|
|
public static void SetDisplayStyle(VisualElement target, DisplayStyle displayStyle)
|
|
{
|
|
if (target == null)
|
|
return;
|
|
|
|
target.style.display = displayStyle;
|
|
}
|
|
|
|
public static void AddStyleSheetFromPath(VisualElement target, string styleSheetPath)
|
|
{
|
|
if (target == null)
|
|
return;
|
|
|
|
AddStyleSheet(target, AssetDatabase.LoadAssetAtPath<StyleSheet>(styleSheetPath));
|
|
}
|
|
|
|
static void AddStyleSheet(VisualElement target, StyleSheet styleSheet)
|
|
{
|
|
if (styleSheet == null || target == null)
|
|
return;
|
|
|
|
target.styleSheets.Add(styleSheet);
|
|
}
|
|
}
|
|
}
|