Changing text render in runtime

I’m using ue5.2 blueprint and I want to change text render during runtime for example if the text render says john Adams I want to be able to write a new text in the text render node without having to leave the simulation.

the Text being rendered should be an String, so as long as that String is exposed as an accessible variable then it can be modified, and the text should change even in real time.

if this is say a Floating text not part of a widget you should be able to find the floating text item in the Level Hierarchy and just change the text there.

to do this programmatically

  • in C++ you can do this with an
UFUNCTION(Exec)
void MyExecFunction(UWorld* World, FString Args)

where you would then do work on the Args as console only gives strings and the like

  • Blueprint Functions under Graph->Advanced have an “Exec” bool which when ticked does have the function show in the console at runtime, but World is not an acceptable function input in a blueprint defined function, and just

doesn’t make sense as it takes in a string and should just output it…

another possible way is to have an input button on the keyboard change the value, but that is just as clunky, and would have to be pre-configured.

so are you saying it doesn’t make sense to do this in blueprint?

it can make sense to do it in blueprints, but if you want to do it through the dev console I can’t figure out how to get the blueprint version of UFUNCTION(Exec) to work.

if it is an accessible text field outside of a widget (if this is for inside a widget then the widget would need to read the value from somewhere else) then just change the string (if it is say floating text then the string variable is exposed by default) which can be done in the objects details window.

for doing it dynamically you just need the trigger and the text you are replacing it with.

Video games are just a complex weaving of triggers and responses to triggers.

im trying to do it through the event graph but im not really familiar with UE so i dont know where to start

what if I want to create the text dynamically

in the content browser I created a new Blueprint of Type Actor (right click in Content Browser/Drawer, select “Blueprint Class”, select “Actor”)

opened the new actor (I named it TextActor, but that doesn’t absolutely matter)

in the hierarchy on the left select “DefaultSceneRoot” click “+Add” type “Text” the option we are look for is “TextRender”
then repeat previous step but type “Box” (the option we are look for is “Box Collider”

go to Even Graph.
under Variables (on the left hand side of your screen) click the “+” twice give these names you think are appropriate (I named them “String1” and “String2” in the box for their type change them both to “Text”
Hit Compile on the Blueprint, then in both of the Text Variables we created set the default Values. Mine I set to “Display Text” and “New Text”
right click “Box” in the hierarchy and under “Add Event” we want OnComponentBeginOverlap() and OnComponentEndOverlap().

in the hierarchy click and drag out “TextRender” into the even graph, and pull the pin releasing and type “Set Text” we are going to end up with something like this
(you can drag those “String1” and “String2” variables out from the Variables section if you don’t want to search for them and select Get)

Hit compile again, save if you want.

in the scene/Level pull out the TextActor into the world (making sure not to have the box around it overlapping anything). now hit play, and move your character next to the floating text, and them move it away.

if everything worked out the text should start out as “Display Text”, then when your character walks next to it the text should change to “New Text”, and when your character walks away it should go back to “Display Text”

I made several assumptions about your knowledge of the engine, and I apologize if I confused you when I did.

the above example shows how to change the text on overlapping with a collider, but in reality this could have been through a function call, or through some other event taking place.