Class AspectRatioFitter
Inherited Members
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.Instantiate(Object, Scene)
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
[AddComponentMenu("Layout/Aspect Ratio Fitter", 142)]
[ExecuteAlways]
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
public class AspectRatioFitter : UIBehaviour, ILayoutSelfController, ILayoutController
Constructors
AspectRatioFitter()
Declaration
protected AspectRatioFitter()
Properties
aspectMode
The mode to use to enforce the aspect ratio.
Declaration
public AspectRatioFitter.AspectMode aspectMode { get; set; }
Property Value
Type | Description |
---|---|
AspectRatioFitter.AspectMode |
aspectRatio
The aspect ratio to enforce. This means width divided by height.
Declaration
public float aspectRatio { get; set; }
Property Value
Type | Description |
---|---|
float |
Methods
IsAspectModeValid()
Declaration
public bool IsAspectModeValid()
Returns
Type | Description |
---|---|
bool |
IsComponentValidOnObject()
Declaration
public bool IsComponentValidOnObject()
Returns
Type | Description |
---|---|
bool |
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Declaration
protected override void OnEnable()
Overrides
OnRectTransformDimensionsChange()
Function called when this RectTransform or parent RectTransform has changed dimensions.
Declaration
protected override void OnRectTransformDimensionsChange()
Overrides
OnTransformParentChanged()
Declaration
protected override void OnTransformParentChanged()
Overrides
OnValidate()
Declaration
protected override void OnValidate()
Overrides
SetDirty()
Mark the AspectRatioFitter as dirty.
Declaration
protected void SetDirty()
SetLayoutHorizontal()
Method called by the layout system. Has no effect
Declaration
public virtual void SetLayoutHorizontal()
SetLayoutVertical()
Method called by the layout system. Has no effect
Declaration
public virtual void SetLayoutVertical()
Start()
Declaration
protected override void Start()
Overrides
Update()
Update the rect based on the delayed dirty. Got around issue of calling onValidate from OnEnable function.
Declaration
protected virtual void Update()