- Mastering UI Development with Unity
- Ashley Godbold
- 360字
- 2021-08-27 18:43:14
Rect Transform component
As stated earlier, UI elements do not have the standard Transform component, they have the Rect Transform component. If you compare it to a standard Transform component, you will see that it has quite a few more properties.

You can use it to change the position, the rotation, and the scale, just as you can with the Transform, but there are the added properties of Anchor Presets (represented by the square image in the top left corner), two values for determining dimension: Anchor Min and Max points, and Pivot point.
It's important to note that the Scale value is considered the Local Scale. If you rescale the object with the Rect Tool, even with the Local positioning mode, the values within Scale will remain at 1.
You may have noted that the labels for the position and dimensional values are different on the preceding illustration than they were on the one provided in the UI Panel Properties section. This is because the labels that represent the position and dimension change depending on the Anchor Preset chosen. We'll discuss how to use these Anchor Preset momentarily, but let's look at some different examples of labels the position and dimensional values can hold.

If the Rect Transform has its Anchor Preset set to not include stretch, as with the top-left example in the preceding screenshot, the values for position are determined by Pos X, Pox Y, Pos Z, and the dimensions are determined by Width and Height.
If the Rect Transform has its Anchor Preset set to include stretch, as with the other three examples, the positions perpendicular to the stretch and the dimensions parallel to the stretch are labeled with Left, Right, Top, and Bottom. These values represent the offset from the border of the parent's Rect Transform.
The Anchor Point of an object determines the point from which all the relative positions are measured from. The Pivot Point determines the point from which the scaling and rotating modifiers happen. It will rotate around this point and scale toward this point. We will look at Anchors and Pivots more thoroughly in the Anchors and Pivot section.
- Java范例大全
- SoapUI Cookbook
- 深入實(shí)踐Spring Boot
- Python從入門到精通(精粹版)
- Hands-On C++ Game Animation Programming
- 重學(xué)Java設(shè)計(jì)模式
- 手把手教你學(xué)C語(yǔ)言
- Node.js Design Patterns
- Visual Basic程序設(shè)計(jì)上機(jī)實(shí)驗(yàn)教程
- Modern C++ Programming Cookbook
- 硬件產(chǎn)品設(shè)計(jì)與開發(fā):從原型到交付
- Vue.js 3應(yīng)用開發(fā)與核心源碼解析
- 物聯(lián)網(wǎng)系統(tǒng)架構(gòu)設(shè)計(jì)與邊緣計(jì)算(原書第2版)
- 大規(guī)模語(yǔ)言模型開發(fā)基礎(chǔ)與實(shí)踐
- Monitoring Docker