I’ve been having issues with this seemingly simple task for sometime now. I have my game set up so when the game starts you setup a player profile (with a name and avatar) the information is saved into a struct. I’m able to populate and display the names in my lobby widget, but have been unable to get it to work in my gamehud (hud which displays other stuff like score and a timer). I’ve managed to get the host name displayed, or the clients named displayed for each player, but it won’t get the name of both players. I’ve tried using a custom playerstate to display the names, but with no success. How can I get the correct players information and display it on my game UI?
at 15:20 you can see how the player names are populated in the lobby menu, i would like to achieve the same but inside a horizontal box and in another level.
Hey thanks for the answer! For some reason I didn’t get a notify in my email for your answer, so I’m seeing it now after I’ve already fixed it :D. I managed to get the player names displayed correctly with a similar method. In the video I linked there are a couple of events that are created in the lobbyPC and lobbyGM, that I used as a basis to display the names. I’ll post an in depth answer soon, thanks again for taking the time to answer =).
So I’ve managed to get the names to display correctly. There were several issues that were preventing me from getting it to work correctly. Firstly I’m not 100% sure if this was an issue ,but I was trying to populate the names into a widget that was created in my player character blueprint (i’m dumb). It should be setup in the playercontroller and called there or in the game mode during initialization.
As I said in a comment to the other answer, I based the logic on the events implemented in the lobbypc and lobbygm, another key factor was how to populate the horizontal box in the widget correctly. Here are some screenshots of events i used.
events in my game hud for populating the horizontal box:
The most annoying and time consuming part of the whole process was testing if it works. The only way you can test if its working is to build the project and copy it to another pc. If you try in editor or on the same computer the game will use the same player info, displaying the same name twice.