Unity Editor 用户界面主要是围绕即时模式 UI 系统构建的。虽然 IMGUI 在某些情况下很出色,但也存在一些严重的设计局限性,因此会影响使用 Editor 功能和扩展功能的所有用户的工作效率。
这便是开发 UIElements 背后的动机。UIElements 是一种保留模式的 UI 的系统,提供样式表、动态/上下文事件处理、可访问性和数据持久性等新功能,开启了改进性能的大门。
UIElements 中的许多概念都基于公认的 Web 技术。如果您熟悉 XML、CSS、JQuery、HTML DOM 和 DOM 事件系统,那么您可能已经熟悉了许多 UIElements 概念。
本指南的目标是介绍框架背后的概念并提供有关如何使用 UIElements 构建交互式用户界面 (UI) 的清晰说明,从而帮助您充分利用 UIElements。
Unity 提供了三个用户界面 (UI) 工具包。应根据以下问题的答案选择 UI 工具包:
运行时开发 UI | 运行时游戏 UI | Editor | |
---|---|---|---|
IMGUI | 用于调试 | 不推荐 | ✔ |
UGUI | ✔ | ✔ | 不可用 |
UIElements | 2019.x | 2020.x | 2019.1 |
UIElements 有望成为游戏开发和 Editor UI 开发的首选工具包。
UIElements 是一项实验性功能,尚不完整,可能会进行重大的 API 调整。UIElements 仍处于开发阶段。
此外,在 2018.3 版中对 UIElements 的更改不会向后移植到旧版本。如果进行升级,还必须升级以前 Unity 版本中的某些元素。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.