x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to Setup a reusable context menu?

I have this situation:

  • 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.

alt text

Product Version: UE 4.8
Tags:
flowchart.png (49.1 kB)
more ▼

asked Jul 21 '15 at 03:41 PM in Using UE4

avatar image

Raziєl
252 33 33 178

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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. alt text

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. alt text

The Final Setup Will be like that

Creating Buttons based on Config alt text

AddButtons to Widget alt text

Config Buttons based on action Index alt text

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.

more ▼

answered Oct 24 '15 at 06:38 PM

avatar image

Raziєl
252 33 33 178

avatar image Peristroff May 07 '17 at 12:20 AM

10/10 It work very well for me, thanks, you're the best

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi, i am having the same problem right now


My current approach is:

  • i created a interface for each possible interaction

  • parent class creates events for all possible interaction and binds functions provided by interface

  • parent class implements states that can enable / disable interactions

  • child class implement interfaces for possible interactions

  • child class implement functions for interactions

  • context menu is generated by HUD class


When an actor is clicked:

  • parent class checks what interfaces are implemented

  • parent class checks states e.g. ( activate / deactivate )

  • parent class create buttons and binds events

  • parent class sends array with all buttons to my "context menu" HUD class

  • child class function is than called via the interface from the parent class event


This approach seem to work good enough if you have a low number of possible interactions but:

  • it gets very confusing when you have more options & states

  • lot of duplicate functions (code) in child classes

  • parent class has to implement events for all possible interactions

  • parent class has to implement all states of child classes


If anyone has a better approach it would be great to know :)

graph.jpg (380.6 kB)
more ▼

answered Oct 24 '15 at 11:13 AM

avatar image

entart3t
11 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question