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 working after widget restarts

Hi everyone! I'm very new to BP - please, be patient))) So, my problem is...

I have a widget that starts with the level and have some buttons. Some of them have a BP code inside same widget event graph (check example on attached image). And others are calling Event Dispatchers (in level blueprint).

First launch of the widget - everything works fine till this widget is closed (remove from parent). When widget fires again all buttons with Event Dispatcher are not working. No problems with other buttons - everything works well.

What I'm doing wrong? Any ideas?

Thanks! alt text

Product Version: UE 4.20
Tags:
more ▼

asked Nov 12 '18 at 11:21 PM in Blueprint Scripting

avatar image

Khadyko
1 2 3

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

1 answer: sort voted first

I dont know but I think maybe the Bind Event needs to be called again and make sure the HUD reference points to the current widget and not the destroyed one. I am new to event dispatchers too. Try my idea and let me know if it helped.

more ▼

answered Nov 12 '18 at 11:56 PM

avatar image

mightyenigma
3.7k 18 23 20

avatar image Khadyko Nov 14 '18 at 02:11 PM

Thanks for reply! But I'm not sure how to implement that((( As I told - I'm noob in BP...

Generally that's a point - how to tell to Dispatcher to work with restarted widget? I've tried Event Tick to make it work, but with no success.

Maybe there are other ways to avoid using Dispatcher at all? Is there any option to get reference of the static meshes/cameras at widget event graph? As I understand it can't be done. Hopefully I'm mistaken)))

avatar image mightyenigma Nov 14 '18 at 07:02 PM

No you can totally get those. It's not very performant and there are better ways than this but it's better than doing the same thing every Tick instead of being event driven :) What you can do is use the GetAllActorsOfClass node, loop through the array it returns until you find the actor you want, then grab its Static mesh. Then the trick is knowing which one of those actors is the right one. You'll have to identify it uniquely using its playercontroller or a Tag or a variable that is always set to something different, or something.

It's not the best way to do things but it works.

avatar image Khadyko Nov 28 '18 at 03:11 PM

Thanks again! I can understand the logic of your advises, but not sure how to implement them in BP. Sadly, but i have to dig deeper into basics of the nodes and how to use them properly.

BUT! After a long break I found a very simple solution and it works fine for me (at least for now).

All is needed is to keep widget(main UI) with dispatchers "alive". So, as it loaded first time - dispatcher started and works, than button push runs another widget on top of main UI and simply disables it's visibility, but not remove from parent. When new widget is closed - main UI is set visible again and that's it!

(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