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"

Event Construction Not Firing

Hi! This is my first time using the answers website of unreal engine so please be kind lol. Here's my question, I have a widget that shows my basic health bar in the designer tab and my blueprint for said widget in the graph tab.

alt text

As you can see, the Event Construct is connected to the Create Widget which is then connected to Add to Viewport. When I press play, the Event Construct will not fire. I've tried looking for the Event BeginPlay too but I can't find it. If you can figure out why the event construct is not working, I will be very happy! :D Thanks in advanced!

Product Version: Epic Games Launcher
Tags:
capture.png (60.6 kB)
more ▼

asked Jun 19 '17 at 10:54 PM in Blueprint Scripting

avatar image

SteelShot
6 2 2

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

4 answers: sort voted first

Event Construct is only called when the widget is created. If this widget isn't being created by something else, then this code won't execute.

Widgets can't execute BeginPlay because they never exist in a level when BeginPlay happens.

I suggest, you add this code to your custom GameMode's BeginPlay, or create a custom HUD object to manage this.

more ▼

answered Jun 19 '17 at 11:06 PM

avatar image

BenVlodgi
2.2k 39 17 52

avatar image ipninichuck Jun 19 '17 at 11:21 PM

BenVlodgi is correct...sorry...got ahead of myself. You need to create the widget in a separate object such as the GameMode.

avatar image SteelShot Jun 20 '17 at 05:17 AM

I've tried adding this FirstPersonCharacter blue print but in the blueprint. Also, where is the "GameMode"?

avatar image SteelShot Jun 20 '17 at 05:18 AM

Sorry, meant to say that in the blue print it does not show "add to viewport"

avatar image BenVlodgi Jun 20 '17 at 08:35 AM

If you want to put this code in your FirstPersonCharacter, copy exactly what you have above, and put it on the BeginPlay event.

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

First Welcome to AnswerHub, we always promise to be nice. UE4 user got to stick together. Begin play would be the best place to create the widget. All you are missing is a 'Get Player Controller' node that plugs into the Owning Player pin.

more ▼

answered Jun 19 '17 at 11:03 PM

avatar image

ipninichuck
311 7 4 8

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

Hi all! I have figured out a solution to this problem. I needed to create a HUD interface so I can then have the begin play option because the Widget blueprint does not have that event. Also, thanks to @ipninichuck for the "other character" problem. But thank you all for helping ^_^

more ▼

answered Jun 20 '17 at 06:40 PM

avatar image

SteelShot
6 2 2

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

Add to Viewport should show up if you drag from the output pin of 'create widget' node and then right click and select it from the drop down menu. The game mode blueprint can be found in your FirstPersonBP folder in your particular case. You can also make your own and change to your custom game mode in your project settings under the tab 'maps and modes'.

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/SettingUpAGameMode/Blueprints/

more ▼

answered Jun 20 '17 at 07:36 AM

avatar image

ipninichuck
311 7 4 8

(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