Canvas Scaler
Canvas Zoom
The canvas Scaler component is used for controlling the overall scale and pixel density of UI elements in the canvas. This scaling affects everything under the Canvas, including font sizes and image borders.
The canvas zoom component controls the overall scale and pixel density of UI elements in the canvas. This scale affects everything under the canvas, including the font size and image borders.
Properties
Property
property: |
Function: |
UI scale Mode |
determines how UI elements in the Canvas is scaled. |
constant Pixel Size |
makes UI elements Reta In the same size in pixels regardless of screen size. |
scale with screen Size |
makes UI elements b Igger the bigger is. |
constant physical Size |
makes UI elements r Etain the same physical size regardless of screen size and resolution. |
Properties |
function |
UI scale Mode |
Determine how to scale UI elements in the canvas |
Constant Pixel Size |
Keeps UI elements the same pixel size regardless of screen size |
Scale with Screen Size |
The larger the screen, the greater the UI element |
Constant Physical Size |
Keeps UI elements the same physical size regardless of screen size and resolution
|
Settings for Constant Pixel Size:
property: |
Function: |
scale Factor |
Scales all UI elements in the Canvas by this Factor. |
Reference Pixels per unit |
If a sprite have this ' Pixels Per unit ' setting, then one pixel I n the sprite would cover one unit in the UI. |
Properties |
function |
Scale Factor |
Scale all UI elements in the canvas at this scale |
Reference Pixels Per Unit |
If the sprite has a ' Pixels Per unit ' setting, then one pixel in the sprite will overwrite one unit in the UI
PS: Here before you can not understand, then looked at the following image of the source, roughly like this: pixelsPerUnit = spritePixelsPerUnit / referencePixelsPerUnit
In general, the Spritepixelsperunit default value of the wizard is 100,referencepixelsperunit default is 100, so except for a bit is 1. This is the so-called one pixel in the sprite would cover one unit in the UI
|
Settings for scale with screen Size:
Property
: |
Function: |
Reference Resolution |
The resolution UI layout is designed for. If the screen resolution is larger, the UI would be scaled up, and if it's smaller, the UI would be scaled down. |
Screen Match Mode |
A mode used to scale the canvas area if the aspect ratio of the current resolution doesn ' t fit the reference resolution. |
Match Width or Height |
Scale the canvas area with the width as reference, the height as reference, or something in between. |
Expand |
Expand the canvas area either horizontally or vertically, so the size of the canvas would never be smaller than the Referen Ce. |
Shrink |
Crop the canvas area either horizontally or vertically, so the size of the canvas would never be larger than the reference. |
Match |
Determines if the scaling is using the width or height as reference, or a mix in between. |
Reference Pixels Per Unit |
If a sprite has this ' Pixels Per Unit ' setting, then one pixel in the sprite would cover one Unit in the UI. |
Properties |
function |
Reference Resolution |
The design theory size of the user interface layout. If the screen resolution is larger than it is, the UI will be zoomed in, and if it is smaller, the UI will be scaled down |
Screen Match Mode |
If the aspect ratio of the current resolution does not conform to the reference resolution, the mode used to scale the canvas area |
Match Width or Height |
Scale the canvas with a width reference, or zoom in as a reference to height, or between the two |
Expand |
Expand the canvas area horizontally or vertically, so the size of the canvas will never be smaller than the reference |
Shrink |
The canvas area is cropped horizontally or vertically, so the size of the canvas will never be larger than the reference |
Match |
Determines whether the zoom uses width or height as a reference, or a blend between the two |
Reference Pixels Per Unit |
If the sprite has a ' Pixels Per unit ' setting, then one pixel in the sprite will overwrite one unit in the UI
|
Settings for Constant physical Size:
property: |
Function: |
Physical Unit |
the physical unit to specify positions and sizes in. |
Fallback screen dpi |
the DPI to assume if the screen dpi is not known. |
Default Sprite DPI |
the pixels per inch to use for sprites that has a ' pixels per Unit ' se Tting that matches the ' Reference Pixels Per Unit ' setting. |
Reference Pixels per unit |
If a sprite have this ' Pixels Per unit ' setting and then its DPI wil L MATCH the ' Default Sprite ' DPI ' setting. |
Property
: |
Function: |
Physical Unit |
The physical units used to specify the location and size |
Fallback Screen DPI |
If the screen dpi is unknown, the DPI is assumed to be this value (dots per inch, dots/inches) |
Default Sprite DPI |
Pixels per inch for sprites with ' Pixels per unit ' set, matched with ' Reference Pixels per unit ' |
Reference Pixels Per Unit |
If the sprite has a ' Pixels Per Unit ' setting, its DPI will match the ' default Sprite dpi ' setting. |
Settings for World space canvas (shown when canvas component are set to World space):
Settings for the World Space canvas (displayed when the canvas component is set to World space):
property: |
Function: |
Dynamic Pixels per unit |
The amount of Pixels per unit to use for dynamically creat Ed bitmaps in the UI, such as Text. |
Reference Pixels per unit |
If a sprite have this ' Pixels Per unit ' setting, then one pixel I n the sprite would cover one unit in the world. If the ' Reference Pixels per unit ' is set to 1 and then the ' Pixels per unit ' setting in the sprite would be used As-is. |
Properties |
function |
Dynamic Pixels Per Unit |
The number of pixels, such as text, for each cell of a dynamically created bitmap in the UI. |
Reference Pixels Per Unit |
If an elf has this ' Pixels Per unit ' setting, then one pixel in the sprite will cover one unit of the world. If ' Reference Pixels per unit ' is set to 1, then the ' Pixels per unit ' setting in the sprite will be used as-is (1 units 100 pixels)
|
Details
Details
For a canvas set to ' screen space-overlay ' or ' screen Space-camera ', the canvas Scaler UI scale Mode can is set to Con Stant Pixel size, scale with screen size, or Constant physical size.
For a canvas set to "screen Space-overlay" or "screen Space-camera", you can set the canvas zoom UI zoom mode to constant Pixel size, scale with screen size, or cons Tant physical Size (which is the one mentioned above)
Constant Pixel Size
Fixed pixel size
Using the Constant Pixel Size mode, positions and sizes of UI elements is specified in pixels on the screen. This was also the default functionality of the canvas when no canvas Scaler was attached. However, with the scale Factor setting in the Canvas Scaler, a constant scaling can is applied to all UI elements in the C Anvas.
Using the fixed pixel size mode, the position and size of the UI elements are specified in pixels on the screen. This is also the default feature of canvas when the canvas scaler is not connected. However, with the scale factor setting in canvas scaler, constant scaling can be applied to all UI elements in the canvas.
Scale with Screen Size
As the screen size scales
Using the scale with screen Size mode, positions and sizes can is specified according to the pixels of a specified referen CE resolution. If The current screen resolution is larger than the reference resolution, the Canvas would keep have only the resolution Of the reference resolution, but would scale up in order to fit the screen. If The current screen resolution is smaller than the reference resolution, the Canvas would similarly be scaled down to fit .
With the scale and screen size mode, you can specify the location and size based on the pixels of the specified reference resolution. If the current screen resolution is greater than the reference resolution, the canvas will remain at a resolution of only a reference resolution, but will be scaled up to fit the screen. If the current screen resolution is less than the reference resolution, the canvas will be scaled to fit as well.
If The current screen resolution have a different aspect ratio than the reference resolution, scaling each axis Individuall Y to fit the screens would result in non-uniform scaling, which is generally undesirable. Instead of this, the Referenceresolution component would make the Canvas resolution deviate from the reference resolution I n order to respect the aspect ratio of the screen. It is possible to control how this deviation should behave using the-screen Match Mode setting.
If the current screen resolution and reference resolution are different, scaling each axis individually to fit the screen will result in uneven scaling, which is usually not expected. In contrast, the referenceresolution component causes the canvas resolution to deviate from the reference resolution to respect the aspect ratio of the screen. Use the screen Match mode setting to control the method of deviation.
Constant Physical Size
Fixed physical dimensions
Using the Constant physical Size mode, positions and sizes of UI elements is specified in physical units, such as Millime Ters, points, or picas. This mode is relies on the device reporting it screen DPI correctly. You can specify a fallback dpi-to-use for devices a DPI.
Using constant physical size mode, the position and size of the UI element is specified in physical units (for example, millimeters, dots, or pickups). This mode relies on the device to correctly report its screen dpi. You can specify fallback dpi for devices that do not report dpi (fallback DPI is not reported as the default).
World Space
World Space
For a canvas set to ' World Space ' the canvas Scaler can is used to control the pixel density's UI elements in the canvas.
For a canvas set to World Space, you can use canvas scaler to control the pixel density of UI elements in the canvas.
Hints
Tips
- See the page designing UI for multiple resolutions for a step by step explanation of how Rect Transform anchoring and Canv As Scaler can used in conjunction-make UI layouts that adapt to different resolutions and aspect ratios.
- See the designing UI for multiple resolutions step-by-step explanation of how the rect transform anchor and canvas scaler are used together, so that the UI layout adapts to different resolutions and aspect ratios.
Unity2017.1 official Ugui document translation--canvas Scaler