Unity之Image & Raw Image

Recommended reading:

Preface

In Unity, image components mainly include Image and Raw Image. Today, I stumbled upon that Raw Image was used by others in the project, but the owner has never used it before. So curiosity drove me to understand it.

Get to know the components

1.
Image Image component is an interactive component
2. Raw Image
RawImage component is used to display non-interactive image controls for decoration or icons. Generally used on backgrounds and icons, it supports UV Rect (used to display only a certain part of the picture). The
difference:
1. Raw Image supports any type of texture; Image control only supports Sprite type texture
2. Raw Image supports UV Rect( Used to display only a certain part of the picture), and Image does not support UV Rect.

Image

Insert picture description here
Component attribute introduction:
1. Source Image: Specify the displayed texture image. Note: Image only supports Sprite type pictures.
2.Color: Picture color.
3.Material: Image rendering material.
4.Raycast Target: Whether it can perform ray detection.

In addition to the above attributes, if a texture image is formulated, several attributes will be added, and the attribute panel will become as follows:
Insert picture description here
4. Image Type: used to set the display type of the image, different display types will cause Sprite" The way to fill the Image component is different. The display types include:
(1) Simple: When the size of Image and Sprite are different, Sprite will be stretched to the same size as Image. This operation may cause the image to be deformed. If you don't want the image to be deformed, you can check the PreserveAspect option, and the Sprite will stretch according to the original Sprite width and height ratio.
(2) Sliced: Jiugongge, Sprite processed by Jiugongge, during the scaling process, the slices of 4 corners will be kept without scaling, the slices of 4 sides are only stretched, and only the middle slice is scaled. In this mode, the Fill Center option is checked by default. If it is unchecked, the Image cannot be displayed completely, and only the edge image of the slice will be displayed.
(3) Tiled: The floor tiles are tiled. In this mode, the size of the Sprite itself will remain unchanged, and the Sprite will fill the entire Image control like a floor tile.
(4) Filled: This mode is generally used as a "CD" skill cooling, allowing the Image to be fully displayed part by part in a certain way.

Raw Image

RawImage is functionally similar to the Image component, but the properties are not exactly the same.
Insert picture description here
Component attribute introduction:
1.Textture: texture picture used for display (any type)
2.Color: same as Image
3.Material: same as Image
4.Raycast Target: same as Image
5.UV Rect: set UV zoom, offset (ie Only let the picture show a part, you can use the atlas)
Note: x, y attributes control UV left and right, up and down offset; W, H control the number of repetitions of UV.

Guess you like

Origin blog.csdn.net/shirln/article/details/108714303