I have a “Interactive Blueprint” (actors) (main class)
I have “Object Blueprint” (child of interactive blueprint actor) (doors, fences, containers)…
I Have a “Context Menu Blueprint” (child of Object Blueprint) (reusable context menu with UMG)
A Player interacting with ONE instance all this combined.
Considering:
“Interactive Blueprint” provide the basic interaction, as is Overlaping, is object clicked.
Each type of “Object Blueprint” have your own events, like Toggle Door, Toggle Lock, Create Barricade, destroy, etc…
“Context Menu Blueprint” is empty by default, and when player interacts with a “Object Blueprint” this fills his child with menu options based on his context.
Keep in mind that my main problem is to assign one of a door event to a button, with manageable way using “editable variables”.
How I can construct a Configurable “Object Blueprint” that takes an array of options and create the necessary buttons WITH ITS OWN AND SPECIFIC EVENTS?
I know how to feed the context menu with new buttons, the problem is in the “Event Bind” because doors have different events of the chairs. Also, I would like to say that the X door, has Open, Close and Lock. And the Y door has only Open and Close. I would not want to have to manually specify each event for each object type.
1 - Create a Button Estage Structure, this will hold our button text, stage and action index.
2 - Create a BP Widget Context Menu. This Will hold our Container UMG and Show to Player
3 - Create A BP Interactive Object, add BP Widget Context Menu. Create 2 Editable vars, ObjectName and Buttons Array, Buttons Array is Type of Button Estage Structure.
4 - On BP Interactive Object, Create 2 Functions, AddButton And ConfigActions. The First Function will basicaly look for our WidgetContextMenu UMG and append butons on that, and the Other Will Determine What Action Index, will be Executed on each UMG button press. Create some Custom Events to Hold Our Binds.
Create some Child to Test, like a Door.
On Door, just use The Custom Event Actions to Call your especific function for each diferente asset.
Here is the [Complete Setup][6]. With a Door to test.
Anyone can use this on your projects, but wihout the art of UMG. Just customize for your project.