Hi there,
We are trying out the Modular Gameplay framework, which our project could benefit from. We are creating our first Game Feature plugin that will add a tool in our Game. Let’s say the tool is called ColorTool.
The ColorTool has it’s own modal Widget panel. The widget modifies the currently selected Actor ( present in the level ).
The ColorTool widget itself lives in the plugin.
Some logic for this tool gets added to the Actor via a Blueprint Component. That component lives in the plugin, and gets added to the actor by the plugin as an Action defined in the plugin’s data asset.
[Image Removed]
Now there is one last piece that is needed to make this work. The Color Tool Widget gets launched from a menu already existing in the main game. When the plugin isn’t loaded, that menu button ( let’s call it ColorToolButton ) does nothing. But when the plugin is active, ColorToolButton should launch the ColorTool widget.
We contemplated the idea of creating a BP component that we would add to the MenuBar. But we learned that Blueprint widgets don’t have BP components.
One way to go about this would be to have ColorToolButton emit an EventDispatcher. Then in the plugin, create an Actor called ColorToolSetup maybe, that finds the ColorToolButton, and listens to the click event, and launches the ColorTool widget.
Is there a more elegant way to do this tough, maybe using a dedicated Action in the Feature Plugin’s data asset? We liked the idea of adding functionality to the MenuBar directly, like an addon.
Your expert input would be greatly appreciated, thank you!
--- Update on 07/09 ----
We refactored the Menu Widget with a new function that creates the ColorTool Button, adds it to the menu, and defines a binding where the ColorTool launches when the button gets clicked.
It would be amazing if we could move this function into some kind of a component that would call it, say, On Construct, and the component would be added to the Menu Widget by the Feature Plugin. Not sure how to do that yet.