1. Introduction to UGUI
UGUI is the UI system that comes with the Unity engine, officially called: Unity UI
is currently the most widely used UI system development solution in Unity commercial game development
It is a UI system based on Unity game objects and can only be used for game UI functions
cannot be used to develop user interfaces built into the Unity editor
(1) History of UGUI development
Initial version of Unity ~ Unity4.6 version:
Unity officially only provides GUI for game UI development, so the more advanced and convenient NGUI is the best choice for UI
After Unity4.6 version:
Unity officially recruits NGUI authors to join Unity and assist Unity in developing the UGUI system for game UI function development
Since the functions of UGUI were not perfect after its launch, it has gone through a long transition period, and it was not officially popularized until the era of Unity5.
(2) Comparison of different UIs
Develop UI at runtime | Runtime Game UI | Unity Editor | |
---|---|---|---|
UIElements | to be determined | to be determined | ✔️ |
Unity UI | ✔️ | ✔️ | unavailable |
A GUI | for debugging | Not recommended | ✔️ |
UGUI is currently the most popular UI development solution for Unity games on the market
Most commercial game companies use UGUI for development
So it is more important than GUI and NGUI
So we must learn to master them, it is a necessary skill for employment
2. Overview of the six basic components
(1) Using UGUI
Right-click directly in the Hierarchy window and select UI, all content in the UI is UGUI-related controls
After creating the UI, click the following two buttons to easily edit the UI content
(2) Six basic components
Attached to the Canvas object:
- Canvas: Canvas component, mainly used to render UI controls
- Canvas Scaler: Canvas resolution adaptive component, mainly used for resolution adaptation
- Graphic Raycaster: ray event interaction component, mainly used to control ray response related
- RectTransform: UI object position anchor point control component, mainly used to control the position and its method
Attached to the EventSystem object:
- EventSystem 和 Standalone Input Module:
Player input event response system and independent input module components, mainly used to monitor player operations
entSystem 和 Standalone Input Module:
Player input event response system and independent input module components, mainly used to monitor player operations