As a Roblox developer, it is currently too hard to seamlessly change the icons of actions and menus declared in plugins.
This is because these objects exist as singletons that cant be recreated once initialised. The reason this is needed is to make icons that respect the theming of Studio if the theme is changed.
Currently, assuming I’m using Tabby, I would have to implement a dirty API that deletes the old Instance and creates a new one, and this likely wouldn’t work because I cant tell if people are still hanging onto an older version of the object exposed through
GetMount. This is assuming Roblox even lets me reinitialise actions if their old one gets deleted.
If Roblox is able to address this issue, it would improve my development experience because I’d be able to switch the icons of menus and actions when the theme changes seamlessly without having to rely on hacky code to accomplish the same task.
So it turns out recalling
CreatePluginAction does NOT change the action params at all, so yeah this is impossible right now
Yep. Im not sure if this is even a bug or if its intended.
How I solve this in my plugin is by adding a GUID to the front of the action name, and then I use string.sub to remove it when an action is clicked. Not ideal but its probably the only way right now.
Absolute support for this feature request.
To confirm, are you asking for a
PluginAction.Icon : ContentId property, like
PluginMenus have an
Icon property that should work - please file a bug if it’s broken.
CreatePluginAction does NOT change the action params at all
Do you mean that
:Destroy()'ing an action, then creating a new one with the same id but different text+icons doesn’t work? e.g.
local action = plugin:CreatePluginAction("my_action_id", "Action text", "", "rbxassetid://12345")
action = plugin:CreatePluginAction("my_action_id", "Different text!", "", "rbxassetid://67890")
From my testing if I create a PluginAction, destroy it, then create a new one with different parameters (but the same internal ID), it’ll show up as the same shortcut not changing the icon or text, I’m pretty sure this is derived from the same bug that affects Toolbars/Toolbar Buttons
And yes, thats basically what Im asking for (wasn’t aware of PluginMenu.Icon lol)