UIGroup component allows you to create a group of items and get access to any item by name or id.
UIGroup group = GetComponent<UIGroup>();
// get by id
UIItem firstItem = group.GetItem(0);
// get by name
UIItem itemByName = group.GetItem("item (2)");
There is a two items detection modes available - Automatic (default) - Manual
In "Automatic" mode UIGroup detects items from its children.
NOTE: Disabled game objects and game objects with disabled UIItem component are ignores.
"Manual" mode allows to define items for group from anywhere in hierarchy.
For each group item the UIItem.group parameter will be linked to current group.
You may need to force re-init group when items count has been changed in runtime in hierarchy (item added/removed, enabled/disabled)
UIGroup group = GetComponent<UIGroup>();
group.InitForce();
Supported items classes are UIItem and all it descendant.
Array of UIItem items assigned to current group
Debug.Log("UIGroup items count = " + GetComponent<UIGroup>().items.Length);