Plugin Activation Mouse Exclusivity broken by Button:SetActive(false)

I’ve taken the time out of my day to create a repro for this issue (you can pay me later)
BugPlugin.rbxm (1.6 KB)

plugin:Activate(true) should (as far as I know, as the DevHub offers no information on the subject) cause the cursor to stop acting as the select tool, allowing plugin developers to code their own functionality for how the mouse interacts with the viewport. If you call Button:SetActive(false) like you should be, this is only the case for the first button selection you make until the plugin has been deactivated.

Reproduction:

  1. Click on the the button “Thing A”
  2. Try selecting a part (it won’t select, this is intended behavior for plugin:Activate(true))
  3. Now click on the Button “Thing B”
  4. Try selecting a part (it will select, this is NOT intended behavior)

Now you can click “Thing B” a second time to deselect that tool. at this point there should be no buttons highlighted.

Repeat Steps 1-4 again, but this time do “Thing B” first, followed by “Thing A”. The behavior depends on whichever button was clicked first.

Now you may contrast this with the following adaptation of the plugin:
BugPlugin_No-SetActive(false).rbxm (1.6 KB)

In this version, all I’ve done is comment out line 7 where I call :SetActive(false) on the currently active button. If you follow steps 1-4 again, but with this plugin, you will find that all of the behavior works exactly as intended. Both tools, no matter how or when you select them, prevent the mouse from behaving like the select tool. The only issue with this is that now the buttons are permanently highlighted and it’s indistinguishable if the tool is active or not.

This behavior is undocumented, and the DevHub explanation of this function appears to be that this should be a purely visual change, but it’s not. Please fix.

7 Likes

This is a huge dealbreaker for me. I have a sort of edit mode in my plugin which takes exclusive mouse, and while in edit mode, I’d like to toggle between different sorts of display modes and gizmos. I’m looking to communicate to the user of the plugin which modes are currently active through toggleable buttons with :SetActive(true) and :SetActive(false). However by choosing a different display mode, which naturally sets the other display mode buttons inactive by :SetActive(false), the exclusive mouse is lost and the user has to press the button for edit mode again.

Now, I can simply make the buttons not have a toggle state, but this doesn’t tell the user anything about the state of the plugin. I would very much like to have toggle states for the sake of good user experience.

2 Likes

5 years later and the only workaround I’m aware of is manually reactivating the plugin with mouse exclusivity a frame after this is done. Classic Roblox W.