Home > other >  Recommendation: [uGUI] basic layout _Unity3d development technology
Recommendation: [uGUI] basic layout _Unity3d development technology

Time:09-23

basic layout _Unity3d development technology: http://blog.csdn.net/ios_song/article/details/52181858

?? We are going to learn how to relative to the Canvas and other elements to our UI layout, we can create a first Image is used to test, in the GameObject menu option UI - & gt; The Image to create,

The Rect tool
?? Every UI elements with a rectangular, said such convenient layout, select the Rect tool in the toolbar, we'll be able to manipulate the rectangle in the Scene view, the Rect tools can be used in the Unity in a 2 d object and UI system, as well as for 3 d object to be able to use,



Select the toolbar in the Rect tool

?? The Rect tools to move, zoom, rotate the UI elements, once you choose a UI elements, we can click on any position in the rectangle, drag and drop to move the UI elements, we can also click and drag the rectangle boundary or four angles, to adjust the element size, the mouse stay in slightly away from the rectangle of the location of the four corners, the mouse cursor becomes a spinning icon, and then we can click and drag, rotate in any direction,

?? And other tools, like the Rect tools you need to use the Local coordinates of the center of the current element and we need to be set in the toolbar, when we need operation on the UI, it's best to set the Pivot and the Local,



In the toolbar to set the Pivot and Local



RectTransform component
?? RectTransform is a new Transform components, it is used for all of the UI elements, and the conventional Transform components,



RectTransform component

?? RectTransform with conventional Position of the Transform, Rotation and Scale properties, also has a Width and Height properties, is used to determine the size of the rectangle,

1, adjust the size or scale

?? When we use the Rect tool changing object size, for 2 d Sprite and 3 d object, the object will change LocalScale, but when it is used for a RectTransform object, will directly change the width and height, the LocalScale unchanged, so as not to affect the font size, the boundary of the Sliced images, such as

2, the Pivot - Pivot point

?? Pivot location will affect the rotation, the effect of sizing and scaling, when we set up in the toolbar to Pivot mode, you can move in the Scene view RectTransform Pivot,



The Pivot rotate

3, Anchors - anchor

?? RectTransform anchor this layout is introduced, the anchor point in the Scene view is shown as four small triangular handle, and anchor point information will be shown in the Inspector view,

?? If RectTransform parent object is also a RectTransform, child objects can be anchored to the parent object in a variety of ways, for example, anchor child objects to the center of the parent object, or a certain Angle,



UI elements of anchor point set in the center of the parent object, the element from center to maintain constant offset



The right bottom corner of the UI elements anchored to the parent object the element maintains constant offset from the parent object's lower right

?? Anchor, after child objects can also be together with the change of the parent object wide high scale, rectangular each corner to the corresponding anchor has a fixed offset, that is to say, at the upper left of the rectangle to the top left of anchor point offset is fixed, so, rectangular different Angle can be anchored in the parent of rectangular differences,

The teacher's class is very great, if you want to start learning Unity developers, urged everyone to watch the video of the teacher in CSDN and blog! http://my.csdn.net/ios_song

CodePudding user response:

Thanks for sharing, words NGUI and UGUI which better?
  • Related