Class UICollection
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.
Namespace: Microsoft.MixedReality.Toolkit.Experimental.UI
Assembly: cs.temp.dll.dll
Syntax
public class UICollection : MonoBehaviour
Properties
HorizontalSpacing
Declaration
public float HorizontalSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
Items
A list of items in this collection. This list should not be modified directly. Instead use AddItem(RectTransform) and RemoveItem(RectTransform).
Declaration
public List<RectTransform> Items { get; }
Property Value
| Type | Description |
|---|---|
| List<RectTransform> |
MaxHeight
Declaration
public float MaxHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
MaxWidth
Declaration
public float MaxWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
VerticalSpacing
Declaration
public float VerticalSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
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.
Declaration
public void AddItem(RectTransform item)
Parameters
| Type | Name | Description |
|---|---|---|
| RectTransform | item | The UI element to add to the 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.
Declaration
public void RemoveAllItems()
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.
Declaration
public void RemoveItem(RectTransform item)
Parameters
| Type | Name | Description |
|---|---|---|
| RectTransform | item | The UI element to remove from the collection. |
UpdateLayout()
Declaration
protected virtual void UpdateLayout()