A component is treated as a layout element by the auto layout system if it implements ILayoutElement.
Namespace: UnityEngine.UI Assembly: UnityEngine.UI.dll Syntaxpublic interface ILayoutElement
Properties flexibleHeight
The extra relative height this layout element should be allocated if there is additional available space.
Declarationfloat flexibleHeight { get; }
Property Value Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when using UI elements.
public class ExampleClass : MonoBehaviour
{
public Transform MyContentPanel;
//Sets the flexible height on on all children in the content panel.
public void Start()
{
//Assign all the children of the content panel to an array.
LayoutElement[] myLayoutElements = MyContentPanel.GetComponentsInChildren<LayoutElement>();
//For each child in the array change its LayoutElement's flexible height to 100.
foreach (LayoutElement element in myLayoutElements)
{
element.flexibleHeight = 100f;
}
}
}
flexibleWidth
The extra relative width this layout element should be allocated if there is additional available space.
Declarationfloat flexibleWidth { get; }
Property Value Examples
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when using UI elements.
public class ExampleClass : MonoBehaviour
{
public Transform MyContentPanel;
//Sets the flexible height on on all children in the content panel.
public void Start()
{
//Assign all the children of the content panel to an array.
LayoutElement[] myLayoutElements = MyContentPanel.GetComponentsInChildren<LayoutElement>();
//For each child in the array change its LayoutElement's flexible width to 200.
foreach (LayoutElement element in myLayoutElements)
{
element.flexibleWidth = 200f;
}
}
}
layoutPriority
The layout priority of this component.
Declarationint layoutPriority { get; }
Property Value minHeight
The minimum height this layout element may be allocated.
Declaration Property Value minWidthThe minimum width this layout element may be allocated.
Declaration Property Value preferredHeightThe preferred height this layout element should be allocated if there is sufficient space.
Declarationfloat preferredHeight { get; }
Property Value preferredWidth
The preferred width this layout element should be allocated if there is sufficient space.
Declarationfloat preferredWidth { get; }
Property Value Methods CalculateLayoutInputHorizontal()
After this method is invoked, layout horizontal input properties should return up-to-date values. Children will already have up-to-date layout horizontal inputs when this methods is called.
Declarationvoid CalculateLayoutInputHorizontal()
CalculateLayoutInputVertical()
After this method is invoked, layout vertical input properties should return up-to-date values. Children will already have up-to-date layout vertical inputs when this methods is called.
Declarationvoid CalculateLayoutInputVertical()
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