"Unity Notes" Ugui canvas screen fit

Source: Internet
Author: User

1. Use anchors and Pivot in recttransform to fit the layout of controls and forms.

Anchors controls the layout position of the current panel relative to the parent form, can be set to center or upper left corner, and the current panel can automatically layout to the correct position when the parent form is stretched. At the same time, you can set the stretching, such as the main interface is generally full-screen stretching, this situation can be handled here.

Pivot is the anchor position of the current control's coordinate system, and you need to be aware of this setting when adjusting the coordinate position by code.

2, through the canvasscaler settings for multi-resolution adaptation.
Uiscalemode generally select scale with the screen Size and set the design resolution. The other two options are fixed pixel sizes.

Expand is generally selected in screen Match mode, which guarantees that all elements in the UI are inside the display. An option to compare is shrink, which guarantees that no blank edges are left.

3. The idea of multi-resolution is to select expand in Scaler to ensure that all UI elements are inside the screen. A small portion of the interface, such as the main interface, combat interface, etc., set the full-screen stretch in anchors as needed. Note that the meaning of the stretch here is only to set the width and height of the panel, not to affect the scaling of the child controls, but to affect its layout.

4, note that if prefab is loading the UI, set the parent node to use transform. SetParent (root, False) This function is called instead of setting the parent property directly, otherwise there is an issue with recttransform size or coordinate errors.

"Unity Notes" Ugui canvas screen fit

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.