Hi, I’ve spent a good while trying to find solutions to this issue, but Epic forums are usually my last resort!
I’m attempting to give players the ability to change their usernames to a custom username. I have 2 main game levels; the Session Create/Join Level and the main Game Level. Its within the session create level where users (and listen server) are prompted to type in a custom username before joining a game from a UI_Widget. The custom username is stored in a GameInstance blueprint within a variable called “PlayerUserName”. Then once the player is teleported to the main game level, the new username is set from inside the GameMode blueprint.
Currently, if both the client and listen server create a username, I can see the custom username printed in game as I’m using a print string to display the text (so it seems to work for both) but for some reason its only the listen servers name that is actually changed/updated in game, the clients name remains as the default name. (worth noting that the listen servers name is only updated when the client joins the game, but Im sure this is because of the way I’m updating the names in the GameMode)
I’m sure I’m missing a simple step, but I’ve scoured the internet and can’t seem to find a working solution. It’s also worth mentioning that I have a Player Struct that contains PlayerName, Kills and Deaths - but again I cant figure out how to alter or update this. With the above attempt, I was avoiding using this Player Structure just because I’m still new to using it. I’ve attached below corresponding screenshots.
I did try that before, and I’ve tried it again now - but for some reason only the listen server is able to update the ‘player list function’ If the client tries to change its name, nothing happens. I’ve added a print string to the end of the function, and if the client initiates the function - it doesn’t fire. (I’ve also slightly shifted from my earlier approach, and I am now setting the new player name as a variable within my custom player controller, so I’m no longer using the GameInstance class.)
On Post login’s controller reference is the one the Game Mode just created for the joining player. It has not touched the actual client (exception is the HOST).
Knowing this you have to have joining clients spawn, then pass save game data to the servers player controller, then to GM. OR have joining clients create names post spawn.