How do you display a text variable from a blueprint?

Hi,

I’ve been trying to wrap my head around this and followed some tutorials but ultimately couldn’t get this to work.

I’m trying to do the following:

In one blueprint (let’s just call it the input blueprint) - I have a text box in which the user can input text.
In this input blueprint I ask the user for his name.

Sadly I don’t have the screenshots at hand, I can post them later, but declare whatever has been committed to that text box as a variable.

Now - I have another blueprint (let’s call it the output blueprint) - in which I can call the variable with the user’s name - however I’ve been unable to actually display it.

In the designer mode for the output blueprint I’m using a text element to try and display the name.

Could someone please run me through how I need to set up the blueprints?

Hey Vendrium,

To display the information from your text variable, you have to plug it into a “Set Text” node in your output blueprint and turn on its visibility (unless it’s already visible of course).

However the exact setup depends on how you want to trigger your text display. I attached a screenshot of how it could look with a simple key event toggle:

Hi - thanks for your input.

One thing I forgot to mention is that I’m trying to do all this in a widget UI blueprint.

Hi Efrye, I’ve been working with Vendrium to get this to work, and we haven’t managed as of yet. Thanks for your reply.

I think what’s crucial - what he forgot to mention - is that the blueprints involved are widget (UMG or UI or whatever) blueprints.

So basically - the input happens through a text box in one widget blueprint - let’s call it “Text Input BP” where the variable is also stored. Then, another widget blueprint - let’s say “Text Display BP” later tries to get the variable from the former - and replaces its text widget text on the UI with whatever is stored in that variable.

We’ve tried several things to get the communication between the widget blueprints to work - but we always end up with the error “text box reference is not compatible with text reference” when we try to plug in the variable to the set text node.

It seems to me that some casting needs to occur first? Either way, something as simple as this can’t be that difficult! It’s just kind of a puzzle for us Unreal newbies.

Thank you again for your help.

FYI: we’re triggering it through Even Construct, and it is set to visible by default.

Ah, that changes things a little of course.

In order to cast to your input widget you need to create a variable for it when you draw it. Where you cast to depends on where you draw the widget. Assuming you draw it in your character blueprint, it could look something like this:

In your output widget, create your text block in the designer tab. In the details panel, create a binding for the text content and open it via the magnifying glass icon or the graph tab. Here you can cast to your input widget and access your text variable like this:

Of course things might need to be changed up a little depending on your setup, but hopefully this will get you going. :slight_smile:

Hey - I just got home and looking at your post, trying to wrap my head around this.

In your first screenshot - what ‘Set’ are you using?

It’s a variable of the type “User Widget”. An easy way to create it is to right-click on the return value of your “Create Input Widget” node and select “Promote to Variable”.

Hey Efrye, thanks again for all your help so far.
I’ve been quite busy with work so I just returned to this thread to see if I can get this working.

The hardest part for me at the moment is translating your information to my setup - because I don’t have a ‘ThirdPersonCharacter’ blueprint.

I’m trying to display the player name directly in the output widget if you will.

I was wondering in your last screenshot - you have “Target / Input Widget” and “Target / MyName” - how do I create these in the blueprint editor?

Thanks again for all your help so far!

How do you display a text variable in the Details Panel?