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"

Create widget best practices?

Good day! Sorry for newbish question, but still: If we are talking about menu widgets, which class should create 'em and add to viewport ?

Let's consider the following case :) I create the main menu with the standard buttons like "Start game", "Settings", "Exit". On button click event, I validate some manager class and call its corresponding method.

In the following tutorial on youtube the author creates the events for button clicks and calls methods from GameInstance inherited class object. But as it is shown in the following article ue4 docs- for the pause menu PlayerCharacter creates widget and adds it to the viewport. And as third option, I've placed 'em into the game mode alt text

So what are the best practices, where I should place such methods? For example, I need to have the possibility to create a widget for setting from 2 places: the main menu and the pause menu. Duplicating creation methods doesn't sound right for me.

Thanks in advance!

Product Version: UE 4.14
1.png (242.9 kB)
more ▼

asked Jan 20 '17 at 10:16 PM in Using UE4

avatar image

5 3 5

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

1 answer: sort voted first

I personally create widgets from my character pawn when I can, and from the level blueprint when I can't (because there's no pawn).

more ▼

answered Jan 20 '17 at 10:25 PM

avatar image

2.1k 67 84 77

avatar image s3lfik Jan 20 '17 at 10:42 PM

Seems legit :) Thanks! But what about situation, when you need the same widget in different levels? Just duplicate creation? I know, it's not a big deal to copy a couple nodes, but still..

avatar image CleanCut Jan 20 '17 at 10:49 PM

That is what I do for outside-the-game levels. Each level blueprint opens its own widgets.

You could certainly do it some other way (there's lots of ways you could get it done).

For example, you could make a blueprint that does your fancy menu handling in its BeginPlay, and then just drag an instance of that blueprint into each of the levels you want it to fire on.

(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