Unity Ugui Base Image

Source: Internet
Author: User

The Ugui image is equivalent to the Ngui sprite component for displaying the picture.


First, the image component:



Source image (Image source): A picture resource with a textured format of Sprite (2D and UI) (select texture type as Sprite (2D and UI) after importing the picture).

Color: The color of the picture overlay.

Material (material): a material superimposed on a picture.

Raycast Target (Ray projection): If the target is a ray projection, then the Ugui Ray detection is ignored after closing.

Image type (picture display type):

Simple (Basic): Picture Zhangquan display, not cut, not superimposed, depending on the size of the border will be stretched.

Preserve Aspect (lock ratio): For simple mode, after the check, regardless of the shape of the image to zoom in or zoom out, will always maintain the initial length and width ratio.




Image type (picture display type):

Sliced (sliced): Picture slice display, on the project page select the picture, switch to Sprite (2D and UI) mode, click the Sprite editor into the picture cropping mode, the picture is trimmed to the shape of the above image, after using sliced mode, Depending on the frame of the picture, the four corners of the picture remain intact, while the 1 and 4 sections stretch as the picture stretches horizontally, and the 2 and 3 chapters stretch as the picture stretches vertically, and the middle part of the picture stretches 5 to fill.

Fill Center: When checked, 5 is displayed, whereas 5 is not visible.



Image type (picture display type):

Tiled (tiled): If the picture has been cropped, then using the tiled mode, according to the picture border stretch, the picture's four corners will remain intact, and the 1 and 4 parts will stretch with the picture's transverse stretching, 2 and 3 chapters with the picture stretching and stretching, the middle part of the picture will be tiled with 5. If the picture is not cropped, then use tiled mode, according to the picture border stretch, the picture remains the original size does not change, but only with its own tile fill.

Fill Center: (This option is available for cropped image sources) when checked, 5 is displayed, whereas 5 is not visible.



Image type (picture display type):

Filled (filled): determines which part of the picture is displayed depending on how the fill is filled, the start of the fill, and the fill scale.

Fill method: Divided into horizontal, vertical, 90-degree circle, 180-degree circle, 360-degree circle.

Fill origin (fill start): Varies depending on how the fill is filled.

Fill Amount (fill scale): 0 is completely not displayed, 1 is fully displayed.



Second, the use of skills:


Function 1: I want to dynamically switch the image source in the program, including any picture on my computer's hard drive.

Idea: First we want to read the picture into the byte stream, and then convert to a sprite, you can directly assign to image, the code is as follows:


Passed the parameter bytes as a picture file conversion byte array, as to how to turn, online a lot of, here do not explain, texture2d for a texture2d variable, return _sprite can be directly assigned to image source.


Feature 2: I also want to add shadow effects and stroke effects like text to a picture

Shadow effects: Or add a shadow effect component


Stroke effects: Or add a stroke effect component



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.