The canvas and EventSystem of the Unity engine GUI

Source: Internet
Author: User

Recently wanted to write a set of basic use of all the controls Ugui tutorial series, mainly based on my experience and part of the test with a literal translation to write, so it may be difficult to avoid the wrong place.

All right, since this is the first article, I think I need to introduce the Ugui two components: Canvas and EventSystem

In fact, the first time the Ugui control is created in the scene, both objects are automatically added to the scene, and of course, it is not the two objects, but the components they are mounted on.

First, canvas, as the parent of all Ugui controls, manages the layout of all subordinate controls.

Canvas Components:

Render mode: This is where screen Space-camera is generally selected, similar to the Ngui-like way of rendering the UI with a particular UI camera, and this rendering mode is best for the individual, and he completely manages the scene objects and UI, Make late development more eye-catching and easy to manage.

Render camera: Set up the standalone camera rendering mode, where you specify a camera to render the UI, and the camera's properties make some necessary transfers.

Clear flags is set to depth only (render depth only), culling mask retains only the UI layer, projection is set to orthographic (orthogonal mode), and the value of depth depth must be greater than the value of the scene master camera. This will keep the UI on top of the scene object.

Canvas Scaler Components:

UI scale mode (UI scaling): This is how the UI scales when adaptive, and here's the second way to follow the screen zoom.

Reference Resolution (reference resolution): Generally set to 1920*1080, the current mainstream of the best resolution, the overall UI will be based on the 16:9 way to adapt to scaling.

Graphic Raycaster Components:

This component acts as an indispensable component of the Ugui open ray projection, and its properties we do not have to move, to maintain the initial value.

Second, EventSystem as the whole Ugui of the event system (of course he can also allocate non-UI objects events).

Event System component: an indispensable component for getting and distributing events

Standalone Input Module components: standard input modules

The touch input module component:

These three components are indispensable, and if not necessary, we do not have to change their properties, to maintain the initial value.

With these two steps, you can then develop the Ugui interface.

The canvas and EventSystem of the Unity engine GUI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.