Skip to main content

LabelledButtonWrapper

A class in Root.Township, the global namespace.

A physical button with a text label that updates when the label changes.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private PhysicalButton buttonBacking field for Button, the wrapped physical button.
private string labelBacking field for Label.
private TextRenderer textRendererThe text that shows the label.

Properties​

MemberWhat it is
PhysicalButton Button { get; }The wrapped physical button.
string Label { get; set; }The button text. Setting a new value updates the text and raises LabelChanged.

Events​

MemberWhat it is
event Action<LabelledButtonWrapper> LabelChangedRaised when the label changes.

Methods​

MemberWhat it is
protected void Awake()Shows the serialized label and starts updating the text on changes.
1 private and internal method
MemberWhat it is
private void OnLabelChanged(LabelledButtonWrapper buttonWrapper)Copies the new label to the text renderer.

Used in​

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