UICollection Class

Definition

This component represents and ordered collection of UI elements. You can add to the UICollection by either dropping UI elements in the UI element this component is attached to in the Editor or by calling the AddItem(RectTransform) method. UI elements that are added to this collection via the Editor will be automatically arranged when this component executes. To use this component attach it to a UI element (a GameObject with a RectTransform component) such as an Image or Panel.

public ref class UICollection : UnityEngine::MonoBehaviour
[UnityEngine.AddComponentMenu("Scripts/MRTK/Experimental/UICollection")]
[UnityEngine.ExecuteInEditMode]
[UnityEngine.RequireComponent(typeof(UnityEngine.RectTransform))]
public class UICollection : UnityEngine.MonoBehaviour
[<UnityEngine.AddComponentMenu("Scripts/MRTK/Experimental/UICollection")>]
[<UnityEngine.ExecuteInEditMode>]
[<UnityEngine.RequireComponent(typeof(UnityEngine.RectTransform))>]
type UICollection = class
    inherit MonoBehaviour
Public Class UICollection
Inherits MonoBehaviour
Inheritance
UnityEngine.MonoBehaviour
UICollection
Attributes
UnityEngine.AddComponentMenuAttribute UnityEngine.ExecuteInEditModeAttribute UnityEngine.RequireComponentAttribute

Constructors

UICollection()

Properties

HorizontalSpacing
Items

A list of items in this collection. This list should not be modified directly. Instead use AddItem(RectTransform) and RemoveItem(RectTransform).

MaxHeight
MaxWidth
VerticalSpacing

Methods

AddItem(RectTransform)

Adds a UI element to the collection. This will cause the collection layout to update immediately. NOTE: The added item's RectTransform will get modified in order to layout properly in this collection.

RemoveAllItems()

Removes all UI elements added to the collection. This will cause the collection layout to update immediately. NOTE: This method does not call Destroy removed items.

RemoveItem(RectTransform)

Removes a UI element from the collection. This will cause the collection layout to update immediately. NOTE: This method does not call Destroy removed items.

UpdateLayout()

Applies to