Basic layout of Ugui technology using _unity3d development _ Blue Gull

Source: Internet
Author: User

Basic layout of "ugui"

Wen/Song (author)

in This section we will learn how to compare Canvas and other elements to lay out our UI . We can create an image to test, and select UI--- image from the gameobject menu .

Rect Tool

each   ui  elements are represented by a rectangle, which facilitates layout. Select   in the toolbar, tool, We can be in  , scene  This rectangle is manipulated in the VIEW. rect  tools can be used for   unity  2d  objects and   ui  system, to   3d 

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/86/28/wKiom1e2fVHxETXwAABddHMV89c278.png-wh_500x0-wm_3 -wmp_4-s_2896379731.png "style=" float:none; The basic layout of "title=" Ugui technology use _unity3d to develop "alt=" Wkiom1e2fvhxetxwaabddhmv89c278.png-wh_50 "/>

Select the Rect tool in the toolbar

rect  tools to move, scale, rotate   ui   Element. Once a   is selected, element, We can click anywhere in the rectangle to drag and drop, to move the   ui  Element. We can also adjust the size of the element by clicking and dragging the border of the rectangle or four Corners. Hover your mouse over the four corners of the rectangle slightly away, and the mouse cursor will turn into a rotating icon, and then we can click and drag to rotate in any Direction.

As with other tools, Rect the tool needs to use the center point and local coordinates of the current element, which we need to set in the Toolbar. When we need to work with the UI , It's best to set up Pivot and Localfirst.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/86/28/wKioL1e2fVHRs-XMAAA6yvLOn20846.png-wh_500x0-wm_3 -wmp_4-s_2788710822.png "title=" Ugui Technology Basic layout using _unity3d development "style=" float:none; "alt=" Wkiol1e2fvhrs-xmaaa6yvlon20846.png-wh_50 "/>

Set Pivot and Local in the toolbar

Recttransform Components

Recttransform is a new Transform component that is used for all UI elements, and for general Transform components are not the Same.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/86/28/wKioL1e2fVPSeW88AASwYo5TmRE479.png-wh_500x0-wm_3 -wmp_4-s_427413577.png "title=" Ugui Technology Basic layout using _unity3d development "style=" float:none; "alt=" Wkiol1e2fvpsew88aaswyo5tmre479.png-wh_50 "/>

Recttransform components

Recttransform has Position,Rotation , and Transform in Conventional scale property, You also have a Width and the Height property that determines the size of the Rectangle.

1, Adjust the size or proportion

when we use Rect when the tool changes the object size, for 2D Elves and 3D object, It changes the Object's Localscale , but when it is used for a Recttransform object, the width and height are changed directly, keeping Localscale not Change. This will not affect the font size, The boundaries of the sliced picture, and so On.

2, Pivot-pivot Point

The position of Pivot affects the effect of rotation, sizing, and Zooming. When we set up in Pivot mode in the toolbar, we can move the recttransform in the Scene view . Pivot .

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/28/wKiom1e2fVWgPwQNAAP3q9jOdfM773.png-wh_500x0-wm_3 -wmp_4-s_1366967660.png "title=" Ugui Technology Basic layout using _unity3d development "style=" float:none; "alt=" Wkiom1e2fvwgpwqnaap3q9jodfm773.png-wh_50 "/>

Rotate around Pivot

3, Anchors-anchor Point

Recttransform introduces the layout concept of the anchor Point. The anchor points appear as four small triangular handles in the Scene view, and the anchor point information is displayed in the Inspector view.

if Recttransform The Parent object is also a Recttransform , child objects can be anchored to the parent object in various Ways. For example, anchor a child object to the center of the parent object, or to a corner.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/28/wKioL1e2fVyx2oCaAA11AY9VpAI135.png-wh_500x0-wm_3 -wmp_4-s_619736214.png "title=" Ugui Technology Basic layout using _unity3d development "style=" float:none; "alt=" Wkiol1e2fvyx2ocaaa11ay9vpai135.png-wh_50 "/>

The anchor point of the UI element is set at the center of the parent object, and the element remains at a fixed offset from the center

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/86/28/wKiom1e2fWOwqIESAA11AVZ_6qI951.png-wh_500x0-wm_3 -wmp_4-s_875638802.png "title=" Ugui The basic layout of the technology using _UNITY3D development "style=" float:none; "alt=" wkiom1e2fwowqiesaa11avz_ 6qi951.png-wh_50 "/>

The UI element is anchored to the lower-right corner of the parent object, and the element remains at a fixed offset from the lower-right corner of the parent object

After anchoring, the child objects can also be scaled along with changes in the height of the parent Object. Each corner of the rectangle has a fixed offset to the corresponding anchor point, which means that the offset of the upper-left corner of the rectangle to the Upper-left anchor point is Fixed. In this way, the different corners of the rectangle can be anchored to different points in the parent Rectangle.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/86/28/wKioL1e2fWqSt_wkAA11Abr_PqY195.png-wh_500x0-wm_3 -wmp_4-s_722165927.png "title=" Ugui The basic layout of the technology using _UNITY3D development "style=" float:none; "alt=" Wkiol1e2fwqst_wkaa11abr_ Pqy195.png-wh_50 "/>

The corner anchor to the left of the UI element is anchored to the lower-left corner of the parent object, and the right corner is anchored to the lower-right corner of the parent object, where each corner of the element is a fixed distance from its respective anchor Point.

the anchor points are defined as a percentage in the direction of the parent Rectangle's width and height . 0% corresponds to the left or bottom, 50% corresponds to the middle, 100% corresponds to the right or top. But anchor points are not confined to either side or the middle, they can be anchored to any point within the parent Rectangle.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/86/28/wKiom1e2fXGDjtnxAA11AT06IMI266.png-wh_500x0-wm_3 -wmp_4-s_806736709.png "title=" Ugui Technology Basic layout using _unity3d development "style=" float:none; "alt=" Wkiom1e2fxgdjtnxaa11at06imi266.png-wh_50 "/>

The UI element anchors the left vertex to a percentage to the left of the parent object, and the right vertex is anchored to a percentage point to the right of the parent object

we can drag each anchor point individually, or, If they are together, we can click and drag them in the middle of the whole move Them. If we drag the anchor point and hold down the Shift key,the corresponding corner of the UI element rectangle is moved Together.

Another convenient feature of the anchor point is that he can UI the Rectangle Anchor Point of the Element's sibling is automatically aligned to facilitate precise positioning.

4, Anchor presets-preset Anchor Point

in the Inspector view, We can click Recttransform The preset anchor point in the Upper-left corner of the component opens the preset Anchor. It contains some of the most commonly used anchor options, and we can choose a quick set anchor Point. We can set the anchor point to the edge or center of the parent object, or scale as the parent object changes Size. You can set the horizontal and vertical anchor points separately.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/86/28/wKioL1e2fXPwzRI_AATG51nmuFA516.png-wh_500x0-wm_3 -wmp_4-s_877486904.png "title=" Ugui The basic layout of the technology using _UNITY3D development "style=" float:none; "alt=" Wkiol1e2fxpwzri_ Aatg51nmufa516.png-wh_50 "/>

Preset anchor points

The preset Anchor Point panel displays the currently selected anchor point preset value if the current anchor setting exists in the Panel. If the anchor point is not in the same position as the preset position on the horizontal and vertical axes, It is displayed as a custom anchor Point.

5. Anchor points and position properties in the Inspector view

in the Inspector view we are able to find the attribute setting of the anchor point, if not, click Anchor expands the properties before expanding the ARROW. the Min property corresponds to the bottom left of the anchor point in the scene view, andtheMax property corresponds to the top right.

The display of the Position property changes depending on the location of the anchor point, and if the anchor point is in a block, it produces a fixed width or height, and if the anchor points are separated, the rectangle is scaled with the parent Rectangle.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/86/28/wKiom1e2fXaiejeJAASwYo5TmRE243.png-wh_500x0-wm_3 -wmp_4-s_1736630256.png "title=" Ugui Technology Basic layout using _unity3d development "style=" float:none; "alt=" Wkiom1e2fxaiejejaaswyo5tmre243.png-wh_50 "/>

Recttransform components

posx Span style= "font-family: ' the song Body '; >, posy width  and   height   posx  and   posy  pivot   position relative to the anchor Point.

left Span style= "font-family: ' the song Body '; >, right top  and   bottom and   and   bottom 

need to be aware that change   anchor  pivot  position  pivot raw  r  button),  , mode causes anchor points and   pivot 


Basic layout of Ugui technology using _unity3d development _ Blue Gull

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.