Today we will share our impressions of working with the acclaimed framework from Unity - UIToolkit, also known as UIElements. We will cover its main features without diving deep into the code. It is worth clarifying that the team had no previous experience of working with web layout and things that are obvious to professionals in this area may not be obvious to us.
A note from the partner of the MAI IT center and the organizer of the โ VR / AR & AI โ master's program - PHYGITALISM .
Background
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.