今天,我们将分享使用Unity广受赞誉的框架-UIToolkit,也称为UIElements的印象。我们将介绍其主要功能,而无需深入研究代码。值得澄清的是,该团队以前没有使用过Web布局的经验,而对于该领域的专业人员而言,显而易见的事情对我们而言可能并不明显。
MAI IT中心的合作伙伴和硕士课程“ VR / AR&AI ” -PHYGITALISM组织者的注释。
背景
Unity IMGUI , . , , : , . IMGUI UGUI , . UI (Canvas, Image, Button .). IMGUI, : ( ), , , ..
, UGUI, Unity Asset Store. , DoozyUI , , — Procedural UI Image.
Unity 2019.1 — UIElements ( UIToolkit, ) — Unity. , Editor, Runtime roadmap.
Building UI for games with the new UI Builder — Unite Copenhagen.
HTML/XAML/XML CSS . UIElements : UXML , USS , .. , , . , , , USS ( ).
Building UI for games with the new UI Builder — Unite Copenhagen.
UIElements
: preview . , ?
, , 3D 2D , . , GUI . Unity UGUI Canvas, CanvasGroup, LayoutGroup. , . .
, UIElements.
-, runtime. . runtime Unite 2018 .
-, UI. , UGUI .
-, 2D GUI . UI ? .
-, UI . , , . UGUI , .
, Unity , — , Unity . — UGUI.
UIElements . 2019.4, 2020.1 .
runtime , , . - , , runtime. .
. UIElements UGUI. Unity , , UI , . . , UIElements .
Flexbox , , Unity , . , USS CSS , UIElements. , , , , UIBuilder — . UIElements , UGUI, .. UGUI . . , — . .
best practices . , ? . ? , . ? , , , . : - . , -- best practices , , — . .
UIElements UI, IMGUI , , . , , , UIElements , — UIElements . , , .
, , . UGUI, . . Figma, Unity, . , Figma flexbox, CSS , . USS CSS , , . Unity UIBuilder. UIElements inlined styles, UXML. , . . . , , . , , , UGUI.
, . DOTween Pro , , 2D , DOTween.
2020.1 , DOTween’, c . UIToolkitUnityRoyaleRuntimeDemo:
public void AnimatedScale(float endScale, float tweenDuration)
{
experimental.animation
.Scale(endScale, Mathf.RoundToInt(tweenDuration * 1000))
.Ease(Easing.OutQuad);
}
public void MoveTo(Vector2 screenPosition)
{
transform.position =
new Vector3(
screenPosition.x,
screenPosition.y,
transform.position.z);
}
public void AnimatedMoveTo(Vector2 endPosition, float tweenDuration)
{
experimental.animation
.Position(
new Vector3(
endPosition.x,
endPosition.y,
transform.position.z),
Mathf.RoundToInt(tweenDuration * 1000)).Ease(Easing.OutQuad);
}
Listview UIElements — , . UGUI “ ” , EnhancedScroller, . , .
. , . , EventSystem Event Generation: Read Input ( ) IMGUI Events.
Read Input Listview , .. ProcessMouseEvents() UIElementsEventSystem . IMGUI Events . , . , Unity Technologies.
. -. , CSS , . . VisualElement , UIBuilder. , , inlined , , — . , . , . . UIElements , .
, — , . , , Unity UIElements.
, , Unity. , . Windows WebGL, , . - UIElements . , . , , .
, UIElements , .. , Google, , Unity .
, , ?
, UIElements PC , , UIElements. “” , , UGUI.