Version: 2023.2
User interface (UI)
UI 工具包

Unity 中 UI 系统的对比

UI Toolkit is intended to become the recommended UI system for your new UI development projects. However, in the current release, UI Toolkit does not have some features that Unity UI (uGUI) and Immediate Mode GUI (IMGUI) support. uGUI and IMGUI are more appropriate for certain use cases, and are required to support legacy projects.

This page provides a high-level feature comparison of UI Toolkit, uGUI, and IMGUI, and their respective approaches to UI design.

General consideration

The following table lists the recommended and alternative system for runtime and Editor:

2022 Recommendation Alternative
Runtime Unity UI UI Toolkit
Editor UI Toolkit IMGUI

Roles and skill sets

团队的技能集以及对不同技术的习惯程度也是一个重要的考虑因素。

The following table lists the recommended system for different roles:

Roles UI 工具包 Unity UI
(uGUI)
IMGUI Skill sets
程序员 程序员可以使用任何游戏开发工具或 API。
技术美术师 部分支持 熟悉 Unity 基于游戏对象的工具和工作流程的技术美术师可能会习惯使用游戏对象、组件和 Scene 视图。

他们可能不习惯 UI 工具包类似于 Web 的方法或 IMGUI 的纯 C# 方法。
UI 设计师 部分支持 UI designers who are familiar with UI creation tools are likely to be comfortable with UI Toolkit’s document-based approach and can use the UI Builder to visually edit their UI.

If they are not familiar with GameObject-based workflows, they might require help from programmers or level designers.

Innovation and development

UI Toolkit is in active development and releases new features frequently. uGUI and IMGUI are established and production-proven UI systems that are updated infrequently.

uGUI and IMGUI might be better choices if you need features that are not yet available in UI Toolkit, or you need to support or reuse older UI content.

Runtime

uGUI is the recommended solution for the following:

  • UI positioned and lit in a 3D world
  • VFX with custom shaders and materials
  • Easy referencing from MonoBehaviours

UI Toolkit is an alternative to uGUI if you create a screen overlay UI that runs on a wide variety of screen resolutions. Consider UI Toolkit to do the following:

  • Produce work with a significant amount of user interfaces
  • Require familiar authoring workflows for artists and designers
  • Seek textureless UI rendering capabilities

Use Cases

The following table lists the recommended system for major runtime use cases:

2022 Recommendation
Multi-resolution menus and HUD in intensive UI projects UI Toolkit
World space UI and VR Unity UI
UI that requires customized shaders and materials Unity UI

In details

The following table lists the recommended system for detailed runtime features:

2022 UI 工具包 Unity UI
WYSIWYG authoring
Nesting reusable components
Global style management
Layout and Styling Debugger
Scene integration
Rich text tags 是*
Scalable text 是*
Font fallbacks 是*
Adaptive layout
Input system support
Serialized events
Visual Scripting support
Rendering pipelines support
Screen-space (2D) rendering
World-space (3D) rendering
Custom materials and shaders
Sprites / Sprite atlas support
Dynamic texture atlas
Textureless elements
UI anti-aliasing
Rectangle clipping
Mask clipping
Nested masking
UI transition animations
Integration with Animation Clips and Timeline

*Requires the TextMesh Pro package

Editor

UI Toolkit is recommended if you create complex editor tools. UI Toolkit is also recommended for the following reasons:

  • Better reusability and decoupling
  • Visual tools for authoring UI
  • Better scalability for code maintenance and performance

IMGUI is an alternative to UI Toolkit for the following:

  • Unrestricted access to editor extensible capabilities
  • Light API to quickly render UI on screen

Use Cases

The following table lists the recommended system for major Editor use cases:

2022 Recommendation
Complex editor tool UI Toolkit
Property drawers UI Toolkit
Collaboration with designers UI Toolkit

In details

The following table lists the recommended system for detailed Editor features:

2022 UI 工具包 IMGUI
WYSIWYG authoring
Nesting reusable components
Global style management
Layout and Styling Debugger
Rich text tags
Scalable text
Font fallbacks
Adaptive layout
Default Inspectors Yes
Inspector: Edit custom object types
Inspector: Edit custom property types
Inspector: Mixed values (multi-editing) support
Array and list-view control
Data binding: Serialized properties

其他资源

User interface (UI)
UI 工具包
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961