Skip to main content

ButtonAttribute

A class in Alta.Attributes, the global namespace.

Inspector attribute that draws a button for a bool field and calls a method on the component when it's clicked. Editor only in effect.

Constructors​

MemberWhat it is
ButtonAttribute(string text, string method = null, bool isDelayedCall = true, string validationMethod = null)Creates a ButtonAttribute from text, method, isDelayedCall and validationMethod.

Properties​

MemberWhat it is
bool IsDelayedCall { get; private set; }Whether the method is called on a delayed editor call rather than straight away. Defaults to true.
string Method { get; private set; }Name of the method to call when the button is clicked. Can be null, as with ChooseRandomChild, which reads the bool in OnValidate instead.
string Text { get; private set; }Label shown on the button.
string ValidationMethod { get; private set; }Name of an optional method that decides whether the button is usable.