Hi, this is probably a really dumb question but I can’t find an answer for it, I’m still really really new to UE.
I have coordinates, x,y,z, and I have a int variable.
I want to have the text of the variable appear in my world, at location x,y,z facing the player. Imgur: The magic of the Internet
So if my int == 5, I want the number “5” to appear at x,y,z.
All the guides I found mention attaching the text to an actor or something like that, I literally just want to text to appear at x,y,z, nothing else, no actor no nothing. Any help would be appreciated!
anything that will be placed and visible in the world has to be an actor.
You can make a new actor blueprint and add a text render component to it. In the construction script, set this Integer as the text for the text render component.
On begin play, you can set the actor to SetWorldLocation and input the coordinates you desire.
This actor you can be dragged into the level at design time, otherwise you would need to spawn it from somewhere - like the game mode or level blueprint, for instance.
disregard this// When you create the text render component, look in the details panel and you can set it to screen space, which will make it face the camera at all times.
//
Thanks for the reply! In the construction script, trying to SET the TextRender doesn’t seem to accept any variable, any idea how to fix that? I already checked the “Editable when Inherited” box on the TextRender.
what you’ve got in that set node is a reference to the component. But what you need is to get inside the component and get its actual text variable. You’ll want this node here:
This is helping a lot! I’m starting to understand how things work now I think.
I believe I’m really close to getting it to work, but it’s still not quite working yet, no errors at least.
Basically I’m creating a hexagonal world map with procedural meshes, and I’m creating “regions” which will span multiple hexes. I’m trying to have a visual on how those regions are being distributed by having the number of the region appear over the hex.
When I try to “watch variable” for the text blueprint’s int value, it doesn’t show up in the debugger, it seems like the blueprint is not actually being placed in the world? But everything works properly otherwise.
After some digging, I’m thinking, could it be that the game doesn’t know what level to spawn it in?
My hex grid is being generated in another blueprint’s construction script. This construction script goes through a bunch of functions, and one of them will try to spawn the text blueprint. Do I need to specify what level I want it to spawn in?
I tried to place the text blueprint in the level manually and it appears correctly, so the text works fine.
you should make a new thread for that question. Actually, the original thread title is kind of different from the original question, wherein you were more just asking about how to display some text.
A question about how to spawn an actor within context of multiple levels is pretty different question.
Reason for making separate threads is then it is easy for anybody to search and find the answer if they have similar problem.
As to an answer, I don’t know much about multi-level/level streaming stuff. I’d assume you put something like that in the persistent level, but that’s as much help as I can offer on that. If you make a new thread about it more specific to what you think the problem is, people who know a lot about that will be more likely to see it and offer some advices.