[Unity plugin] NGUI Core Component UIAnchor

Source: Internet
Author: User
NGUI: UIAnchor

The Anchor script can be used for multiple purposes, which are useful in Example0.

1. As long as a half-pixel offset is provided, it can precisely display the position of a control on Windows (only the sub-control of this Anchor is affected)

2. If it is attached to an object, it can attach the object to the corner or edge of the screen.

Parameters

UI Camera is the Camera that renders these objects. If not set manually, it automatically sets the Camera in a scenario.

Side. You can set four corners, four sides, and a central point.

Half Pixel Offset allows an object to be displayed on windows with a Half-Pixel Offset. Select this option on the 2D UI.

Depth Offset is used to adjust the Depth of the location calculated by UIAnchor. It mainly acts on fluoroscopy-based cameras. This value is the coordinates of the world, similar to the camera's near-distance cropping surface.

The Relative Offset of Relative Offset allows you to set the Offset of an object in the unit of half-aspect ratio of the screen.

Tips

1. If a UIAnchor is attached to an object, its transform value cannot be manually modified-they are controlled by scripts. If you want to add an offset to the anchor, add a child object to it. For example, to ensure that your control is always in the (100,100) position, your object structure should be: UI-> Anchor-> Offset-> Widget.

2. if you want to set the position of a widget to 25% on the Left of the screen, you can set it as a sub-object of UIAnchor, and set the Side of UIAnchor to Left, set the X value of Relateive Offset to 0.25.

 

 

Address: http://blog.csdn.net/daiguangda/article/details/7850155

NGUI: UIAnchor

The Anchor script can be used for multiple purposes, which are useful in Example0.

1. As long as a half-pixel offset is provided, it can precisely display the position of a control on Windows (only the sub-control of this Anchor is affected)

2. If it is attached to an object, it can attach the object to the corner or edge of the screen.

Parameters

UI Camera is the Camera that renders these objects. If not set manually, it automatically sets the Camera in a scenario.

Side. You can set four corners, four sides, and a central point.

Half Pixel Offset allows an object to be displayed on windows with a Half-Pixel Offset. Select this option on the 2D UI.

Depth Offset is used to adjust the Depth of the location calculated by UIAnchor. It mainly acts on fluoroscopy-based cameras. This value is the coordinates of the world, similar to the camera's near-distance cropping surface.

The Relative Offset of Relative Offset allows you to set the Offset of an object in the unit of half-aspect ratio of the screen.

Tips

1. If a UIAnchor is attached to an object, its transform value cannot be manually modified-they are controlled by scripts. If you want to add an offset to the anchor, add a child object to it. For example, to ensure that your control is always in the (100,100) position, your object structure should be: UI-> Anchor-> Offset-> Widget.

2. if you want to set the position of a widget to 25% on the Left of the screen, you can set it as a sub-object of UIAnchor, and set the Side of UIAnchor to Left, set the X value of Relateive Offset to 0.25.

 

 

Address: http://blog.csdn.net/daiguangda/article/details/7850155

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.