UIStateGroup allows to manage group of UIStateItem items and perform bulk state change
In editor view UIStateGroup provides functionality to change all items to particular state
UIStateGroup implements callback event OnStateChange that called on each group state change
Scripting functions listed bellow allows to do more different group states changes.
public UIStateItem GetStateItem( |
| ) |
Gets UIStateItem by name from StateItems array
UIStateItem StateItem = GetComponent<UIStateGroup>().GetStateItem("item (1)");
if (StateItem != null) {
Debug.Log("Found item : " + StateItem.itemName);
}
itemName string | UIStateItem item name |
Found UIStateItem or null
public virtual void ItemStateChanged( |
| ) |
Internal function. Called automatically from UIStateItem for each state change
This function used as an internal callback between components UIStateItem and UIStateGroup
itemName string | item name |
public void SetStateForItem( |
| ) |
Set state for item
GetComponent<UIStateGroup>().SetStateForItem(UIStateItem.STATE_ACTIVE, "item (1)");
GetComponent<UIStateGroup>().SetStateForItem("custom state", "item (1)");
state string | state name |
itemName string | UIStateItem item name |
public void SetStateForItems( |
| ) |
Set state for several items
GetComponent<UIStateGroup>().SetStateForItems(UIStateItem.STATE_ACTIVE, new string [] {"item (1)", "item (3)"});
state string | state name |
itemsNames string[] | string array of UIStateItem items names |
public void SetStateExceptItem( |
| ) |
Set state for all items excluding given item
GetComponent<UIStateGroup>().SetStateExceptItem(UIStateItem.STATE_ACTIVE, "item (1)");
state string | state name |
excludeItemName string | UIStateItem item name to exclude |
public void SetStateExceptItems( |
| ) |
Set state for all items excluding given items names
GetComponent<UIStateGroup>().SetStateExceptItems(UIStateItem.STATE_ACTIVE, new string [] {"item (1)", "item (3)"});
state string | state name |
excludeItemsNames string[] | string array of UIStateItem items names to exclude |
public void SetStateForAllItems( |
| ) |
Set state for all items
GetComponent<UIStateGroup>().SetStateForAllItems(UIStateItem.STATE_INACTIVE);
state string | state name |
This UnityEvent is called when animation transition is finished
You can subscribe any of your functions to this event.
GetComponent<UIStateGroup>().OnStateChange.AddListener(OnGroupStateChange);
...
void OnGroupStateChange() {
Debug.Log("Group state changes!");
}