How to change a text according to the level you are at.

Hello everyone, I am new and need help. I have a box (cube) with a text and I want to change the text depending on the level in which it is. For example, in level 1 the box appears with “2 dollars” and I want that when I pass level that same box put “1 bottle of water” I do not know if I explain. Thank you and excuse my English if it is not good.

Maybe you can have a map variable which holds level number and string in GameInstance class which you can use across in a level blueprint or an actor blueprint if you are using blueprints. And in the blueprint you can just get the text you want based on level and set it on the text renderer or the text widget you are using on the cube.

image

This is how you can lookup by the level.

Where you store the data has many options. Simple thing is just a map variable where key = level name and value = text.

Thank you for answering and putting an image, even so I can not see the way to connect the text box with the level, if you could put some more node I would appreciate it.

Thank you very much for answering, I am too new and maybe I would need to see it. If you could add a picture it would be great. Thanks anyway.

this can be used in the widgets graph.

This way the widget is self contained. It queries and finds the information that it needs.

If you don’t know how to use a variable to change a text widget, you need to start off with any intro to unreal UMG tutorials first.

Thank you very much for commenting and giving me some guidance. I will investigate.