Skip to main content

ButtonCollection

A class in Root.Township, Alta.Meta.UI.

A group of menu buttons where one is selected at a time, like tabs. The selected button is disabled until another is pressed.

Constructors​

MemberWhat it is
ButtonCollection()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private Button[] buttonsThe buttons in the group.
private bool isSetupTrue once Setup has run.
private int startingButtonIndexIndex of the button pressed on setup.

Properties​

MemberWhat it is
Button CurrentButton { get; private set; }The selected button.

Events​

MemberWhat it is
event Action<ButtonCollection> CurrentButtonChangedRaised when a different button is selected.

Methods​

3 private and internal methods
MemberWhat it is
private void HandleButtonPress(Button obj)Selects the pressed button, disables it, enables the others and raises CurrentButtonChanged.
private void Setup()Listens to every button and presses the starting one.
private void Start()Runs Setup if it hasn't run yet.

Used in​

Members of other types that take, return or hold a ButtonCollection: