States are an XML UI frame type that enables you to set up state groups on UI frames. Similar to Constants, States are a “meta” frame that doesn’t create an actual UI object. They’re just for storing information.
There are a variety of uses for state groups:
In some cases, UI needs to be adjusted to account for different margins or cameras on different devices.
Often the enemy will have the same UI as the player, only mirrored or changed to red instead of the player’s color of green or blue. Instead of building separate UI for the player and for the enemy, the same UI can be used with a state to modify the appearance.
Selected items often have a glow outline, which can be easily toggled on/off with state groups.
Equipable items or unlockable gears states of ownership or usage is a common use case for state groups. Typically this involves toggling a “black mask” and a lock icon.