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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to communicate between two widgets

Hey everyone,

I'm trying to get two widgets to talk to each other by using an OnClicked event.

Basically what I want to do is, *Click a button in widget A *Set a bool in widget A to true *Click a button in Widget B to call the Widget A bool to create another widget.

My problem is, I keep getting accessed none errors, I've tried every method I know. But I haven't had any luck. I've been able to communicate between a BP_Actor and a Widget before using Custom Events, but it won't work when I try it with two widgets. I'm also not able to set a value for the Widget A variable in Widget B like the documentation said to do.

Any help would be greatly appreciated.

Here are some screenshots: Widget A: https://gyazo.com/c07c683a6a51a61d5d4f7e1f985e9813 Widget B: https://gyazo.com/ed0c6d3b97f9504e6ada756a86b15c6c

Cheers, Entro

Product Version: UE 4.12
Tags:
more ▼

asked Jun 22 '16 at 04:55 AM in Blueprint Scripting

avatar image

Entropikz
113 18 22 26

avatar image Sundyko Sep 22 '16 at 02:53 PM

I have read the thread and tried what has been mentioned here. But I failed.

I am trying to create a bridge of communication between two widgets, but everything has failed thus far. Simply because I Fail to recreate what has been taught to me, or understand the logic behind them.

I have created a string array holding a list of names of players inside. I want another widget to have an access to this array list, but I have run out of options. If only there was someone who could explain this in some other way than what has been already explained above.

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

3 answers: sort voted first

Kinda depends what you've attached these widgets to, but let's say the Parent here is your player controller (easiest example). One thing that should work is to go back in your controller blueprint and find wherever you've created those widgets in the first place before adding them to the viewport. The create nodes should have a blue output pins on them - right click each and Promote to Variable. Give them names that make sense to you, like "WidgetA" and "WidgetB" in your case. That will save a reference to each that will be important later when you try to communicate between them.

So in Widget A, you can get the owner - which will likely be a generic controller - then Cast To your special type of controller - and then the reference to Widget B can be pulled off that cast node. You can then change a variable or toss an event into B as you wish. If you are doing this in some sort of pawn or character, you might need an extra step to get the controller - then get that thing's "controlled pawn" - cast that to your BP_Actor class and look up your widget references there.

Note that things are cleaner here in 4.12 - if you're still in 4.11 or earlier there's even one more step. Once you have the widget reference to Widget B, you used to have to pull off that and get the user widget object, then Cast To whatever widget type that guy is, and -then- you can get into its variables and events. Way confusing and always seems to take more nodes than it should. If you're blindly trying to find the magic node that does all that, you'd never find it on your own.

more ▼

answered Jun 22 '16 at 05:15 AM

avatar image

1l2Hawk
690 36 35 74

avatar image Entropikz Jun 22 '16 at 05:26 AM

I think I understand what you mean. I'm going to have to try this tomorrow and send some screenshots to see if I understand it right.

avatar image Entropikz Jun 22 '16 at 06:58 AM

I decided to give it a try now and it worked! Thanks for the input, I really appreciate it.

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

One easy way to do this is make one widget create the other widget. So for example Button A widget does a "create widget" for Button B. Then Button A adds itself to a variable in Button B and at the same time Button A adds a variable to Button B. You can easily do this off an Event Construct.

more ▼

answered Jun 22 '16 at 05:03 AM

avatar image

SkeetonYu
405 18 11 31

avatar image Entropikz Jun 22 '16 at 05:10 AM

I'm sorry, but that went a bit over my head. Can you provide a screenshot or two to demonstrate that?

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

Here you go. I hope this helps.

This is in the Widget A Graph. alt text

more ▼

answered Jun 22 '16 at 05:18 AM

avatar image

SkeetonYu
405 18 11 31

avatar image Entropikz Jun 22 '16 at 05:32 AM

Ohhh, okay. That makes sense. Thank you so much for the screenshots. I'm gonna try this out tomorrow as well.

avatar image Entropikz Jun 22 '16 at 06:59 AM

I also tried this and it worked, but the scripts seem a bit cleaner (at least for me) with 1l2Hawk's solution. I really appreciate both of your inputs though, you really got me through a bind.

(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