Unity 提供以下用户界面 (UI) 工具包,用于在 Unity Editor 或应用程序中创建 UI:
OnGUI
函数(以及一些实现 OnGUI 函数的脚本)来绘制和管理其用户界面。可以使用 IMGUI 来创建游戏中的调试显示、脚本组件的自定义 Inspector 以及用于扩展 Unity Editor 的窗口或工具。这不是构建游戏或应用程序的 UI 的最佳选择。应根据以下问题的答案选择 UI 工具包:
运行时开发 UI | 运行时游戏 UI | Unity Editor | |
---|---|---|---|
UIElements | 待定 | 待定 | ✔ |
Unity UI | ✔ | ✔ | 不可用 |
IMGUI | 用于调试 | 不推荐 | ✔ |
UIElements 仍处于开发阶段。它有望成为游戏开发和 Unity Editor UI 开发的推荐 UI 工具包。在此之前,Unity UI 和 IMGUI 中有一些 UIElements 中没有的功能。
此外,在先前版本的 Unity 中可能不存在 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.