Download

How do you display a variable from another blueprint?

Hi,

I’ve asked this question over in the answer hub but sadly didn’t get a reply.

I have two blueprints - one with a text box where the user can insert their name (a text variable). (let’s call it the ‘input’ blueprint)
and one where that name variable is called upon and I want it printed in the GUI.

(Both Blueprints are GUI blueprints)

How can I do this?

You can use a cast to node.
You cast to the blueprint you want the variable from and drag the variable for the as… (your blueprint name)
when you drag from the Cast to node you will see all the variable functions from that blueprint.

Hope it help

Blueprint Communication, google it, watch tutorials, and understand nothing (like most of us after first time).

Hardest thing to get is knowing difference between some virtual Blueprint (BP code that is in content browser), and actual live blueprint somewhere with reference to it (pointer).
Your two UMG blueprints in browser are 2 virtual graphs, that are source code only, they are not placed in game. When you place them both in GUI blueprint as widgets they both are created in game.
And that is when they can communicate. This goes for all blueprints, to communicate they need to be “alive” in game.

So place them both inside umg hud blueprint (they need to be real blueprints not just abstract code in content browser).
Easiest to pass variable over would be either interface, or custom event dispatcher in text box blueprint, but that if you know interfaces or dispatchers.

If you do not know interfaces you need to pass variable manually.

  • set text box widget as variable
  • cast to it from master umg blueprint, read and store user name
  • cast to display name bp, set user name variable there
  • display name.

Or just use BP interface to pass value over. Sadly I am not at my pc now, and cannot write exactly how to do it without unreal editor in my face (not that good with interfaces yet, i prefer dispatchers).

Hello,
To discover more about communication possibilities : Actor Communication | Unreal Engine Documentation and examples : https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintCommsUsage/BPComHowTo/index.html you can also look at videos, tutorials and wiki (check the learn tab in launcher)

This is nice 3 replies in same time :smiley:

Haha - thanks guys - yes I’ve been going through those tutorials (videos and the communication articles as well) - and I’ve been able to communicate between blueprints.

My set up is that I’ve been trying to do all this in a widget UI blueprint - and just have not been able to display a text variable that is set by the user in a text box.

But I’ll act on your advice as soon as I’m home :slight_smile: