Rendering 2D Text in 3D space

Hello!

I am currently trying to render text above my pawns. Multiplayer replication works really well and I am slowly getting the concepts between all these different classes and the concept of how UE4 is built in general.

So for clarification again: I have multiple pawns of the same type, 1 player controller controlls 1 pawn. I am now trying to render 2d text above the pawns in 3d space. Now, the text is not supposed to be “relative” but “absolute” -> distance doesnt affect size. You could also say orthogonal view. Just imagine a player name in multiplayer above a character.

Here is what I did:



The variable “AssociatedPawn” is replicated, same with “PlayerNameWidget”.

The issue is, that, in single player (BOTH no session AND only host in session), when looking away e.g. the position of the widget is not in the screen anymore, the widget vanishes, forever. Even if I change both options on the “Select” node to visible. I spawn in with the widget perfectly fine, however, and it is visible until, well, I look away.

Now my questions are:

  • Is this the correct concept for this feature? The way I want to implement it, I mean
  • What is the issue? Why doesnt this work?

I have google’d of course. Helped me get to this point, but found nothing matching my problems.

Thanks!

You can add in a UMG widget as a component on your character. It can either be rendered in 3D, or projected from world space to screen space (you’ll probably want this option). To get a reference to the actual UMG widget (to change the widget text, for example), grab the reference to the component and plug it into a Get User Widget Objectnode. You can then take the output of that and cast to Playe Name to modify variables/call functions in the widget.