Download

[Basic question] Most basic communication between BP's like PlayerController and Widgets.

Hello. I actually try something for quite a while and while digging through certain tutorials and documentation, I just can’t find one that would fit to my case.

QUESTION: Is there a simple standard procedure for communicating variables (bool, for example) between a Player Controller (or other BP’s) TO a widget – and vice versa.

From this:

To this:

https://forums.unrealengine.com/core/image/gif;base64

https://forums.unrealengine.com/core/image/gif;base64
​Sadly, I also don’t find evidence why I get a NOTE there. Yes, I have a reference for the Widget inside the Player Controller, but any cast needs a reference as well – or not?

I really hope to get some help on this, I really get tired after a week of search. :frowning:

Yes, it’s a bit messy.

You basically have to search for the ‘other’ actor ( whether it is a BP or widget ) with a GetActorOfClass and then you can talk to it.

**@Kajiisan - **choosing a communication method will depend on the context. What is the scenario?

If you only have 1 widget and want the player controller to talk to it (like a main menu), you might as well create the widget in the PC and talk to it directly. In this case a reference variable is enough and *no casting *is required (hence the blue note). Widget talking back to the PC in this scenario would be best handled with Event Dispatchers.

You will need to choose between direct comms, event dispatchers and interfaces often (and occasionally use all at once!). Depends on what’s needed.

Yes, to cast you need an object. But casting has little to do with communication per se, and is not always required. Think of casting as conversion. You already know what type of object you’ll be dealing with it - the main menu, there’s no need to *convert *it to something else. Use it as is.

As above. if you mouseover the note, it will tell you.