Widget to show Text instead of Progress Bar

Hi

I have seen how I can put a Widget with a Progress Bar into a Player BP and show health, but what I am looking for is how to display text, such as name, money, alliance, etc.

I know how to cast to a progress bar, but can not seem to find a away to cast to a text.

Hey,

what you are looking for is not the progress bar. You will need a textfield.

A text field is a different which you will have to place in the editor view of your widget. There are a couple of different things you can use and place. An image, a textfield, a textblock (in which the player can then input some text), buttons and a few others. All serve only their specific purpose.

I would recommend watching the tutorial series by epic about UMG:

or the tutorial for a very basic menu by Tesla:

Both show off the basics pretty well.

I hope this helps.

Cheers

Cheers .

The issue I am having is how do I put data into a Text field in the widget. The screen shot above allows me to modify my heath and the bar goes left and right.

What I would like to do, is to have for example “Money” which I would like to display as “$XXXXX” or something similar.

I can not find away in BP to transfer the money variable in my character to the widget in my character BP.

There are going to be multiply versions of the same BP in the level, so it needs to draw the Data from a specific BP.

If I have the Widget seperate, it only draws the data from the first BP in play.

I hope I explained it better then I did before.

Regards

This is what I am looking for.

Cheers

UE4 Top Down Template extended with Turn Based Shooting (WIP-3) - YouTube

The unreal tutorial had pretty much exactly this in their series.

It’s simply a text field with a bind. You provide a reference to your character BP and then just use the variable from there to display whatever variable you’d like. Maybe append it with some other text.

I’ll make a few pictures of maybe a video about what exactly I mean this evening alright ? :slight_smile:

Well you have a few options. It really depends on how exactly it should work.

If all of them should always have the same amount like a bank you could think about saving this amount either in your player character, controller, or player state. Maybe even in a savegame directly (those are surprisingly fast and perform surprisingly well).

If it’s more like a few different entities who have something similar you could use the game state or (which is a quite bad solution though) get in your construction script “all actors of class” and scan through if there is one of this type without a reference to another set or if any of those exist at all. If there is one without a reference pick this as reference and use the money variable in there. Otherwise leave it empty and use the own variable.

It really depends on your specific usecase and coding preferences :wink:

I would probably suggest you to store structs of all this data in a savegame. It works fast, reliable and through all levels while you can have multiple once really easy (if you use it to store the data by default you won’t have to add it later when actually saving the game. Even better you might not even need to save at all!

Here’s the documentation for savegames in blueprint:

https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Blueprints/index.html

A struct is basically a collection of variables (in this case level, production per second / minute / hour, current stock and whatever you wanna save).

Thank you.

I made it work, but had issue with it collecting only from 1st BP in game.

Here is example how it only reference 1st BP.

https://forums.unrealengine.com/attachment.php?attachmentid=23159&d=1421941804

Thanks for helping again.

Cheers for response,

I want for example, 3 factories that produce metal. I am playing 1st person. So I would like to walk up to each factory, each is the same BP, get how much output it has, how much it has stored and level.

Later on, I want to hire AI to collect the produce.

I hope this helps you help me.

Regards

Cheers again for your help.

It is the binding issue I am having. Binding to Progress bar - easy. do not have a clue how to bind to text.

I will start searching for bindings and see what I find.

Regards

SOLVED

To mark the answer as solved you can just click the accept button (just below the voting arrows of an answer). This will mark that answer as accepted and the questions as solved.

Cheers :wink: