PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. Instead, you should go to our new and improved documentation. You can also learn more about the future of documentation.
Collapse Sidebar

Enabled

PluginToolbarButton

bool

Enabled determines whether a button is clickable in general. When this property is false, the button will be greyed out and unclickable, preventing the user from firing the PluginToolbarButton/Click|Click event. Buttons are enabled by default.

Plugins should disable their buttons when the button action isn’t relevant in the current context. For example, a plugin button that assigns random colors to selected should not be enabled when the selection contains no parts. See the code samples for more information.

See also

  • PluginToolbarButton/ClickableWhenViewportHidden|ClickableWhenViewportHidden, which determines whether a button is clickable when the game view is hidden (and not just in general)


Code Samples


BrickColor Randomizer Plugin

This code sample is for a studio Plugin. The plugin creates a PluginToolbarButton which randomizes the BasePart/BrickColor|BrickColor of each selected part using BrickColor.random(). Furthermore, the button is only enabled if at least one part is selected. It does this by detecting changes in the Selection using Selection/SelectionChanged|SelectionChanged.