Component.GetComponentIndex()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, InstantiateParameters)
Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: UnityEngine.UI Assembly: UnityEngine.UI.dll Syntax[RequireComponent(typeof(Canvas))]
[ExecuteAlways]
[AddComponentMenu("Layout/Canvas Scaler", 101)]
[DisallowMultipleComponent]
public class CanvasScaler : UIBehaviour
Constructors CanvasScaler() Declaration Fields m_DefaultSpriteDPI Declaration
[Tooltip("The pixels per inch to use for sprites that have a 'Pixels Per Unit' setting that matches the 'Reference Pixels Per Unit' setting.")]
[SerializeField]
protected float m_DefaultSpriteDPI
Field Value m_DynamicPixelsPerUnit Declaration
[Tooltip("The amount of pixels per unit to use for dynamically created bitmaps in the UI, such as Text.")]
[SerializeField]
protected float m_DynamicPixelsPerUnit
Field Value m_FallbackScreenDPI Declaration
[Tooltip("The DPI to assume if the screen DPI is not known.")]
[SerializeField]
protected float m_FallbackScreenDPI
Field Value m_MatchWidthOrHeight Declaration
[Tooltip("Determines if the scaling is using the width or height as reference, or a mix in between.")]
[Range(0, 1)]
[SerializeField]
protected float m_MatchWidthOrHeight
Field Value m_PhysicalUnit Declaration
[Tooltip("The physical unit to specify positions and sizes in.")]
[SerializeField]
protected CanvasScaler.Unit m_PhysicalUnit
Field Value m_PresetInfoIsWorld Declaration
[SerializeField]
protected bool m_PresetInfoIsWorld
Field Value m_ReferencePixelsPerUnit Declaration
[Tooltip("If a sprite has this 'Pixels Per Unit' setting, then one pixel in the sprite will cover one unit in the UI.")]
[SerializeField]
protected float m_ReferencePixelsPerUnit
Field Value m_ReferenceResolution Declaration
[Tooltip("The resolution the UI layout is designed for. If the screen resolution is larger, the UI will be scaled up, and if it's smaller, the UI will be scaled down. This is done in accordance with the Screen Match Mode.")]
[SerializeField]
protected Vector2 m_ReferenceResolution
Field Value m_ScaleFactor Declaration
[Tooltip("Scales all UI elements in the Canvas by this factor.")]
[SerializeField]
protected float m_ScaleFactor
Field Value m_ScreenMatchMode Declaration
[Tooltip("A mode used to scale the canvas area if the aspect ratio of the current resolution doesn't fit the reference resolution.")]
[SerializeField]
protected CanvasScaler.ScreenMatchMode m_ScreenMatchMode
Field Value Properties defaultSpriteDPI
The pixels per inch to use for sprites that have a 'Pixels Per Unit' setting that matches the 'Reference Pixels Per Unit' setting.
Declarationpublic float defaultSpriteDPI { get; set; }
Property Value dynamicPixelsPerUnit
The amount of pixels per unit to use for dynamically created bitmaps in the UI, such as Text.
Declarationpublic float dynamicPixelsPerUnit { get; set; }
Property Value fallbackScreenDPI
The DPI to assume if the screen DPI is not known.
Declarationpublic float fallbackScreenDPI { get; set; }
Property Value matchWidthOrHeight
Setting to scale the Canvas to match the width or height of the reference resolution, or a combination.
Declarationpublic float matchWidthOrHeight { get; set; }
Property Value physicalUnit
The physical unit to specify positions and sizes in.
Declarationpublic CanvasScaler.Unit physicalUnit { get; set; }
Property Value referencePixelsPerUnit
If a sprite has this 'Pixels Per Unit' setting, then one pixel in the sprite will cover one unit in the UI.
Declarationpublic float referencePixelsPerUnit { get; set; }
Property Value referenceResolution
The resolution the UI layout is designed for.
Declarationpublic Vector2 referenceResolution { get; set; }
Property Value scaleFactor
Scales all UI elements in the Canvas by this factor.
Declarationpublic float scaleFactor { get; set; }
Property Value screenMatchMode
A mode used to scale the canvas area if the aspect ratio of the current resolution doesn't fit the reference resolution.
Declarationpublic CanvasScaler.ScreenMatchMode screenMatchMode { get; set; }
Property Value uiScaleMode
Determines how UI elements in the Canvas are scaled.
Declarationpublic CanvasScaler.ScaleMode uiScaleMode { get; set; }
Property Value Methods Handle()
Method that handles calculations of canvas scaling.
Declarationprotected virtual void Handle()
HandleConstantPhysicalSize()
Handles canvas scaling for a constant physical size.
Declarationprotected virtual void HandleConstantPhysicalSize()
HandleConstantPixelSize()
Handles canvas scaling for a constant pixel size.
Declarationprotected virtual void HandleConstantPixelSize()
HandleScaleWithScreenSize()
Handles canvas scaling that scales with the screen size.
Declarationprotected virtual void HandleScaleWithScreenSize()
HandleWorldCanvas()
Handles canvas scaling for world canvas.
Declarationprotected virtual void HandleWorldCanvas()
OnDisable() Declaration
protected override void OnDisable()
Overrides OnEnable() Declaration
protected override void OnEnable()
Overrides OnValidate() Declaration
protected override void OnValidate()
Overrides SetReferencePixelsPerUnit(float)
Sets the referencePixelsPerUnit on the Canvas.
Declarationprotected void SetReferencePixelsPerUnit(float referencePixelsPerUnit)
Parameters Type Name Description float referencePixelsPerUnit
The new reference pixels per Unity value
SetScaleFactor(float)Sets the scale factor on the canvas.
Declarationprotected void SetScaleFactor(float scaleFactor)
Parameters Type Name Description float scaleFactor
The scale factor to use.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4