Following on from this thread… Active property of GUIs not working
Now that the property (poorly) named Active has had its behaviour cleared up after so long, this now means that there isn’t even a broken property that allows us to disable input on a GuiObject.
Therefore I suggest a new property/behaviour called “Enabled”
Why this is needed
Often, you may find that you want to disable a button that the player shouldn’t be able to click yet, but may in future.
Such examples of this include:
- In a level based game, you may want the player to only click on unlocked levels, and disable click events on other buttons.
- Items in a simple crafting system that you don’t want people clicking if they haven’t unlocked them yet.
- Anything where a button may be clickable in future, but you don’t want generating events now (usually because it would otherwise involve extra code to prevent the player from activating something they can’t)
Usage
Would be used with any TextButton, ImageButton and potentially even TextBox.
The issue with communicating that the button/textbox is locked on purpose (to avoid bad UX) would be up to the developer.
TextButton.Enabled = false
With this, any input events would be ignored. Any functions listening for mouse events wouldn’t be activated.
Its not the biggest problem in the world because it has a relatively simple but often ‘hacky’ way to get around. It would be a nice property to have. Especially as a lot of people (myself included) probably think/thought that .Active was supposed to do this already.