UIStateGroup

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

Callbacks

UIStateGroup implements callback event OnStateChange that called on each group state change

Details

Scripting functions listed bellow allows to do more different group states changes.

Summary
UIStateGroupUIStateGroup allows to manage group of UIStateItem items and perform bulk state change
Properties
StateItemsArray of all detected UIStateItem items
StatesString array of all states grabbed from StateItems
Functions
GetStateItem (itemName)Gets UIStateItem by name from StateItems array
ItemStateChanged (itemName)Internal function.
SetStateForItem (state, itemName)Set state for item
SetStateForItems (state, itemsNames)Set state for several items
SetStateExceptItem (state, excludeItemName)Set state for all items excluding given item
SetStateExceptItems (state, excludeItemsNames)Set state for all items excluding given items names
SetStateForAllItems (state)Set state for all items
Variables
OnStateChangeThis UnityEvent is called when animation transition is finished

Properties

StateItems

public UIStateItem [] StateItems { get }

Array of all detected UIStateItem items

States

public string [] States { get }

String array of all states grabbed from StateItems

Functions

GetStateItem (itemName)

public UIStateItem GetStateItem(string itemName)

Gets UIStateItem by name from StateItems array

UIStateItem StateItem = GetComponent<UIStateGroup>().GetStateItem("item (1)");

if (StateItem != null) {
    Debug.Log("Found item : " + StateItem.itemName);
}

Parameters

itemNameUIStateItem item name

Returns

Found UIStateItem or null

ItemStateChanged (itemName)

public virtual void ItemStateChanged(string itemName)

Internal function.  Called automatically from UIStateItem for each state change

This function used as an internal callback between components UIStateItem and UIStateGroup

Parameters

itemNameitem name

SetStateForItem (state, itemName)

public void SetStateForItem(string state,
string itemName)

Set state for item

GetComponent<UIStateGroup>().SetStateForItem(UIStateItem.STATE_ACTIVE, "item (1)");
GetComponent<UIStateGroup>().SetStateForItem("custom state", "item (1)");

Parameters

statestate name
itemNameUIStateItem item name

SetStateForItems (state, itemsNames)

public void SetStateForItems(string state,
string [] itemsNames)

Set state for several items

GetComponent<UIStateGroup>().SetStateForItems(UIStateItem.STATE_ACTIVE, new string [] {"item (1)", "item (3)"});

Parameters

statestate name
itemsNamesstring array of UIStateItem items names

SetStateExceptItem (state, excludeItemName)

public void SetStateExceptItem(string state,
string excludeItemName)

Set state for all items excluding given item

GetComponent<UIStateGroup>().SetStateExceptItem(UIStateItem.STATE_ACTIVE, "item (1)");

Parameters

statestate name
excludeItemNameUIStateItem item name to exclude

SetStateExceptItems (state, excludeItemsNames)

public void SetStateExceptItems(string state,
string [] excludeItemsNames)

Set state for all items excluding given items names

GetComponent<UIStateGroup>().SetStateExceptItems(UIStateItem.STATE_ACTIVE, new string [] {"item (1)", "item (3)"});

Parameters

statestate name
excludeItemsNamesstring array of UIStateItem items names to exclude

SetStateForAllItems (state)

public void SetStateForAllItems(string state)

Set state for all items

GetComponent<UIStateGroup>().SetStateForAllItems(UIStateItem.STATE_INACTIVE);

Parameters

statestate name

Variables

OnStateChange

public UnityEvent OnStateChange

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!");
}
UIGroup component allows you to create a group of items and get access to any item by name or id.
UIStateGroupControl extends UIStateGroup into the group of items with only one item selected.
UIStateGroup allows to manage group of UIStateItem items and perform bulk state change
UIStateItem implements different UI item states and provides API to switch between them.
public UIStateItem [] StateItems { get }
Array of all detected UIStateItem items
public string [] States { get }
String array of all states grabbed from StateItems
public UIStateItem GetStateItem(string itemName)
Gets UIStateItem by name from StateItems array
public virtual void ItemStateChanged(string itemName)
Internal function.
public void SetStateForItem(string state,
string itemName)
Set state for item
public void SetStateForItems(string state,
string [] itemsNames)
Set state for several items
public void SetStateExceptItem(string state,
string excludeItemName)
Set state for all items excluding given item
public void SetStateExceptItems(string state,
string [] excludeItemsNames)
Set state for all items excluding given items names
public void SetStateForAllItems(string state)
Set state for all items
public UnityEvent OnStateChange
This UnityEvent is called when animation transition is finished
Close