UIToolkit 探究可接入

UIToolkit

Unity 自己出的UI解决方案
`
UI Toolkit is a collection of features, resources, and tools for developing user interface (UI). You can use UI
Toolkit to develop custom UI and extensions for the Unity Editor, runtime debugging tools, and runtime UI for games and applications.

UI Toolkit is inspired by standard web technologies. If you have experience developing web pages or applications, your knowledge is transferable and the core concepts are familiar.
`
翻译成中文就是 按照网页的逻辑实现UGUI
不管他说的怎么样先看看怎么用

从0开始

官方示例

UnityTry the new UI Toolkit sample – now available on the Asset Store
刚推出稳定版时官方推出的例子 RPG风格

QuizU - A UI toolkit sample
性冷淡风格

官方文档
Unity的官方文档通常都是吹牛的只言片语

功能

Visual tree

An object graph, made of lightweight nodes, that holds all the elements in a window or panel. It defines every UI you build with the UI Toolkit.
一对象渲染。减少UI在Hierachy上的显示内容。很轻量

Controls

UI 的交互组件 Button啥的都能用。

Data binding system

数据绑定,最近很流行的mvvm啥的推荐的内容

Layout Engine

把Web端 Css的内容 改了个名字 Uss

Event System

事件交互但是例子都没看懂

UI Renderer

在游戏里搞点数据表展示啥的信息统计。
一般感觉是电影会用的功能

Editor UI support & Runtime UI Support

能在Unity里正常跑起来。

资源

UXML documents

Html 的 Unity版本。但是在一些操作上更像XML

Unity Style Sheets (USS)

CSS 的 Unity版本

工具

UI Debugger

调试工具

UI Builder

可视化编辑器。虽然是仿照Html但是他的结构更像XML 很多东西都是可视化操作

UI Samples

官方例子

从示例中了解

可取

  1. 通过 Theme 来进行风格切换
  2. 有条理的拆分 Element

不可取

  1. 全用 Static 做系统性 Event 监听.