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 dispatcher not receiving messages

For the life of me, I can't get a simple message from my UI widget blueprint into my pawn blueprint. I simplified it so, that when you simply click a button in the UI, it should send an message to the pawn blueprint. However, it never sends it. Any help?

![alt text

alt text

Product Version: UE 4.14
Tags:
send_message.png (146.9 kB)
more ▼

asked Feb 16 '17 at 10:58 AM in Blueprint Scripting

avatar image

WEe172
6 1 3 5

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

4 answers: sort voted first

"I just simply create a variable and set the variable type to barracks_bp" you need to set this variable to a valid reference of the object afterwards! maybe

  • when creating the ui expose this variable and set it from the baracks bp

  • on begin play or construct of the ui do a get all actors of class

  • or... we need a bit mor information how you've setup :)

You are doing things the wrong direction. never ever posible to do a BIND EVENT on SELF! (tecnically possible but not useful in your case).

Normaly it's easy peasy like:

  • barracks ui has a eventdispatcher name it onClickSomething,

  • in your button (inside barracks ui) onPress event CALL this event dispatcher,

  • in your barracksBP maybe on begin play, get your ui (maybe getHud with a reference to the relevant UMG) and BIND to this event

done. I think it is also possible to bind to the button Event directly from the barracksBP - but, get the easy way first.

more ▼

answered Feb 16 '17 at 01:39 PM

avatar image

Adnoh
240 6 13 17

avatar image WEe172 Feb 17 '17 at 07:14 AM

I followed your tips and changed everything, but still no luck. I think the problem is setting the actual variable, which is not working currently as it returns a none. Could anyone give simple instructions on how to reference the UI properly? I've tried numerous ways but I just can't get it right.

avatar image Adnoh Feb 17 '17 at 01:03 PM

if you provide me some space (ftp, email, git, ...) I try to make a example, screenshotting this all would be some kind of ugly

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

I was able to fix the problem by redoing everything and taking notes of everyones hints. Main problems were setting the variables, which I was able to do using arrays, and setting the event dispatchers properly. Thanks everyone for helping! :)

more ▼

answered Feb 19 '17 at 09:11 PM

avatar image

WEe172
6 1 3 5

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

How are you getting the reference to Barracks in the first image?

It looks to me like you have set up a variable for it of the type Barracks BP. But you still need to Set it with the correct reference.

You could add something like this to Beginplay (or as the first thing you do in this event):

Get all actors of class (Barracks BP) -> GET entry 0 from the resulting array (assuming there is only 1 Barracks BP in your level) -> SET this as your Barracks BP.

After that you will be able to talk to the correct Barracks BP and the dispatcher will probably work.

more ▼

answered Feb 16 '17 at 11:19 AM

avatar image

Fotosynthesis
146 1 4 4

avatar image WEe172 Feb 16 '17 at 12:10 PM

I just simply create a variable and set the variable type to barracks_bp. I tried the array method but it didn't work. The problem is most likely that I don't set the variable properly, which I have hard time getting my head wrapped around.

Is this anywhere near?alt text

set.png (179.3 kB)
avatar image Luiz Sotero Feb 16 '17 at 12:43 PM

Your logic seems weird to me, Your event dispatcher is in Class Barracks and you are calling a message from another class..

Event dispatchers should be : Class A have a dispatcher and by doing something I Call my dispatcher.

In class B You just do a bind to that event dispatcher, if you can bind to it it will appear on the context menu, try typing "Bind " on the search. Have you tried that?

avatar image Fotosynthesis Feb 16 '17 at 01:33 PM

I didn't notice this but yeah you're right. The dispatcher should be inside Barracks_BP, not Barracks_UI.

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

I'd throw some "is valid" checks on all the object references, are you getting red warnings or any thing in your logs about null references?

more ▼

answered Feb 16 '17 at 12:26 PM

avatar image

BPANDREW
995 22 27 125

avatar image WEe172 Feb 16 '17 at 12:29 PM

Nope, no null reference warnings, or warnings to that matter.

avatar image BPANDREW Feb 16 '17 at 01:46 PM

with break points can you verify its being called and acting as expected? i use these a lot and ive never had them fail under basic scenarios

(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