How to Setup a reusable context menu?
I have this situation:
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.
Yes, I´m doing something similar but more simple.
Here we go.
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.
The Final Setup Will be like that
Creating Buttons based on Config
AddButtons to Widget
Config Buttons based on action Index
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. With a Door to test. Anyone can use this on your projects, but wihout the art of UMG. Just customize for your project.
Hi, i am having the same problem right now
My current approach is:
When an actor is clicked:
This approach seem to work good enough if you have a low number of possible interactions but:
If anyone has a better approach it would be great to know :)
Follow this question
Once you sign in you will be able to subscribe for any updates here