Class LayoutGroup | Unity UI | 1.0.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class LayoutGroup

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    UIBehaviour
    LayoutGroup
    GridLayoutGroup
    HorizontalOrVerticalLayoutGroup
    Inherited Members
    UIBehaviour.Awake()
    UIBehaviour.Start()
    UIBehaviour.OnDestroy()
    UIBehaviour.IsActive()
    UIBehaviour.OnBeforeTransformParentChanged()
    UIBehaviour.OnTransformParentChanged()
    UIBehaviour.OnCanvasGroupChanged()
    UIBehaviour.OnCanvasHierarchyChanged()
    UIBehaviour.IsDestroyed()
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.UI
    Syntax
    [DisallowMultipleComponent]
    [ExecuteAlways]
    [RequireComponent(typeof(RectTransform))]
    public abstract class LayoutGroup : UIBehaviour, ILayoutElement, ILayoutGroup, ILayoutController

    Constructors

    LayoutGroup()

    Declaration
    protected LayoutGroup()

    Fields

    m_ChildAlignment

    Declaration
    [SerializeField]
    protected TextAnchor m_ChildAlignment
    Field Value
    Type Description
    TextAnchor

    m_Padding

    Declaration
    [SerializeField]
    protected RectOffset m_Padding
    Field Value
    Type Description
    RectOffset

    m_Tracker

    Declaration
    protected DrivenRectTransformTracker m_Tracker
    Field Value
    Type Description
    DrivenRectTransformTracker

    Properties

    childAlignment

    The alignment to use for the child layout elements in the layout group.

    Declaration
    public TextAnchor childAlignment { get; set; }
    Property Value
    Type Description
    TextAnchor
    Remarks

    If a layout element does not specify a flexible width or height, its child elements many not use the available space within the layout group. In this case, use the alignment settings to specify how to align child elements within their layout group.

    flexibleHeight

    See LayoutElement.flexibleHeight

    Declaration
    public virtual float flexibleHeight { get; }
    Property Value
    Type Description
    Single
    Implements
    ILayoutElement.flexibleHeight

    flexibleWidth

    See LayoutElement.flexibleWidth

    Declaration
    public virtual float flexibleWidth { get; }
    Property Value
    Type Description
    Single
    Implements
    ILayoutElement.flexibleWidth

    layoutPriority

    See LayoutElement.layoutPriority

    Declaration
    public virtual int layoutPriority { get; }
    Property Value
    Type Description
    Int32
    Implements
    ILayoutElement.layoutPriority

    minHeight

    See LayoutElement.minHeight

    Declaration
    public virtual float minHeight { get; }
    Property Value
    Type Description
    Single
    Implements
    ILayoutElement.minHeight

    minWidth

    See LayoutElement.minWidth

    Declaration
    public virtual float minWidth { get; }
    Property Value
    Type Description
    Single
    Implements
    ILayoutElement.minWidth

    padding

    The padding to add around the child layout elements.

    Declaration
    public RectOffset padding { get; set; }
    Property Value
    Type Description
    RectOffset

    preferredHeight

    See LayoutElement.preferredHeight

    Declaration
    public virtual float preferredHeight { get; }
    Property Value
    Type Description
    Single
    Implements
    ILayoutElement.preferredHeight

    preferredWidth

    See LayoutElement.preferredWidth

    Declaration
    public virtual float preferredWidth { get; }
    Property Value
    Type Description
    Single
    Implements
    ILayoutElement.preferredWidth

    rectChildren

    Declaration
    protected List<RectTransform> rectChildren { get; }
    Property Value
    Type Description
    List<RectTransform>

    rectTransform

    Declaration
    protected RectTransform rectTransform { get; }
    Property Value
    Type Description
    RectTransform

    Methods

    CalculateLayoutInputHorizontal()

    Declaration
    public virtual void CalculateLayoutInputHorizontal()
    Implements
    ILayoutElement.CalculateLayoutInputHorizontal()

    CalculateLayoutInputVertical()

    Declaration
    public abstract void CalculateLayoutInputVertical()
    Implements
    ILayoutElement.CalculateLayoutInputVertical()

    GetAlignmentOnAxis(Int32)

    Returns the alignment on the specified axis as a fraction where 0 is left/top, 0.5 is middle, and 1 is right/bottom.

    Declaration
    protected float GetAlignmentOnAxis(int axis)
    Parameters
    Type Name Description
    Int32 axis

    The axis to get alignment along. 0 is horizontal and 1 is vertical.

    Returns
    Type Description
    Single

    The alignment as a fraction where 0 is left/top, 0.5 is middle, and 1 is right/bottom.

    GetStartOffset(Int32, Single)

    Returns the calculated position of the first child layout element along the given axis.

    Declaration
    protected float GetStartOffset(int axis, float requiredSpaceWithoutPadding)
    Parameters
    Type Name Description
    Int32 axis

    The axis index. 0 is horizontal and 1 is vertical.

    Single requiredSpaceWithoutPadding

    The total space required on the given axis for all the layout elements including spacing and excluding padding.

    Returns
    Type Description
    Single

    The position of the first child along the given axis.

    GetTotalFlexibleSize(Int32)

    The flexible size for the layout group on the given axis.

    Declaration
    protected float GetTotalFlexibleSize(int axis)
    Parameters
    Type Name Description
    Int32 axis

    The axis index. 0 is horizontal and 1 is vertical.

    Returns
    Type Description
    Single

    The flexible size

    GetTotalMinSize(Int32)

    The min size for the layout group on the given axis.

    Declaration
    protected float GetTotalMinSize(int axis)
    Parameters
    Type Name Description
    Int32 axis

    The axis index. 0 is horizontal and 1 is vertical.

    Returns
    Type Description
    Single

    The min size

    GetTotalPreferredSize(Int32)

    The preferred size for the layout group on the given axis.

    Declaration
    protected float GetTotalPreferredSize(int axis)
    Parameters
    Type Name Description
    Int32 axis

    The axis index. 0 is horizontal and 1 is vertical.

    Returns
    Type Description
    Single

    The preferred size.

    OnDidApplyAnimationProperties()

    Callback for when properties have been changed by animation.

    Declaration
    protected override void OnDidApplyAnimationProperties()
    Overrides
    UIBehaviour.OnDidApplyAnimationProperties()

    OnDisable()

    Declaration
    protected override void OnDisable()
    Overrides
    UIBehaviour.OnDisable()

    OnEnable()

    Declaration
    protected override void OnEnable()
    Overrides
    UIBehaviour.OnEnable()

    OnRectTransformDimensionsChange()

    Declaration
    protected override void OnRectTransformDimensionsChange()
    Overrides
    UIBehaviour.OnRectTransformDimensionsChange()

    OnTransformChildrenChanged()

    Declaration
    protected virtual void OnTransformChildrenChanged()

    SetChildAlongAxis(RectTransform, Int32, Single)

    Set the position and size of a child layout element along the given axis.

    Declaration
    protected void SetChildAlongAxis(RectTransform rect, int axis, float pos)
    Parameters
    Type Name Description
    RectTransform rect

    The RectTransform of the child layout element.

    Int32 axis

    The axis to set the position and size along. 0 is horizontal and 1 is vertical.

    Single pos

    The position from the left side or top.

    SetChildAlongAxis(RectTransform, Int32, Single, Single)

    Set the position and size of a child layout element along the given axis.

    Declaration
    protected void SetChildAlongAxis(RectTransform rect, int axis, float pos, float size)
    Parameters
    Type Name Description
    RectTransform rect

    The RectTransform of the child layout element.

    Int32 axis

    The axis to set the position and size along. 0 is horizontal and 1 is vertical.

    Single pos

    The position from the left side or top.

    Single size

    The size.

    SetChildAlongAxisWithScale(RectTransform, Int32, Single, Single)

    Set the position and size of a child layout element along the given axis.

    Declaration
    protected void SetChildAlongAxisWithScale(RectTransform rect, int axis, float pos, float scaleFactor)
    Parameters
    Type Name Description
    RectTransform rect

    The RectTransform of the child layout element.

    Int32 axis

    The axis to set the position and size along. 0 is horizontal and 1 is vertical.

    Single pos

    The position from the left side or top.

    Single scaleFactor

    SetChildAlongAxisWithScale(RectTransform, Int32, Single, Single, Single)

    Set the position and size of a child layout element along the given axis.

    Declaration
    protected void SetChildAlongAxisWithScale(RectTransform rect, int axis, float pos, float size, float scaleFactor)
    Parameters
    Type Name Description
    RectTransform rect

    The RectTransform of the child layout element.

    Int32 axis

    The axis to set the position and size along. 0 is horizontal and 1 is vertical.

    Single pos

    The position from the left side or top.

    Single size

    The size.

    Single scaleFactor

    SetDirty()

    Mark the LayoutGroup as dirty.

    Declaration
    protected void SetDirty()

    SetLayoutHorizontal()

    Declaration
    public abstract void SetLayoutHorizontal()
    Implements
    ILayoutController.SetLayoutHorizontal()

    SetLayoutInputForAxis(Single, Single, Single, Int32)

    Used to set the calculated layout properties for the given axis.

    Declaration
    protected void SetLayoutInputForAxis(float totalMin, float totalPreferred, float totalFlexible, int axis)
    Parameters
    Type Name Description
    Single totalMin

    The min size for the layout group.

    Single totalPreferred

    The preferred size for the layout group.

    Single totalFlexible

    The flexible size for the layout group.

    Int32 axis

    The axis to set sizes for. 0 is horizontal and 1 is vertical.

    SetLayoutVertical()

    Declaration
    public abstract void SetLayoutVertical()
    Implements
    ILayoutController.SetLayoutVertical()

    SetProperty<T>(ref T, T)

    Helper method used to set a given property if it has changed.

    Declaration
    protected void SetProperty<T>(ref T currentValue, T newValue)
    Parameters
    Type Name Description
    T currentValue

    A reference to the member value.

    T newValue

    The new value.

    Type Parameters
    Name Description
    T

    Extension Methods

    UIBehaviourExtensions.InvokeOnEnable(UIBehaviour)
    UIBehaviourExtensions.InvokeOnDisable(UIBehaviour)
    UIBehaviourExtensions.InvokeAwake(UIBehaviour)
    UIBehaviourExtensions.InvokeRebuild(UIBehaviour, CanvasUpdate)
    UIBehaviourExtensions.InvokeLateUpdate(UIBehaviour)
    UIBehaviourExtensions.InvokeUpdate(UIBehaviour)
    UIBehaviourExtensions.InvokeOnRectTransformDimensionsChange(UIBehaviour)
    UIBehaviourExtensions.InvokeOnCanvasGroupChanged(UIBehaviour)
    UIBehaviourExtensions.InvokeOnDidApplyAnimationProperties(UIBehaviour)
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on October 6, 2020