Is the playerName a random number after you call it? Keep in mind too that the online subsystems will set the player name to associated name of the subsystem, for example the steam subsystem will set it to the steam name of the player.
I’ve tested this in 4.15 and I’m not seeing the same results. On my end, I can SetPlayerName, and then if I log the Player Name I will see the correct name that I’ve just set.
Could you provide me with the code that you’re using so I can take a closer look at your setup? Are you able to reproduce the issue in a clean 4.15 project?
Thanks for the info. I’ve spent some time testing your project, and I’ve realized that what’s happening is the Player State’s Set Name function is actually being called by default in the player state after you’ve called it in your code, from what I can tell. If you notice, even if you print the player name in your character bp on begin play, it will return a number.
Here’s what I’d recommend: Create your own player state class, override the SetPlayerName function (don’t call the Super) and then call that function from your game mode to set your player name. This will prevent the original implementation of SetPlayerName from overriding the name you chose. Just make sure to set the Player State to the new one you created in your game mode so that it’s using the correct Player State instead of the default one.
Let me know if that works, otherwise we can continue to look for other solutions.
Ok I see what you mean.
Will you change the calling order in future version or stay like it is now ? It’s quite wierd to apply default name after a player has connected to your game.
By the way my game is an online multiplayer. I saw some “net code” in SetPlayerName function. Wouldn’t it cause some problem in multiplayer context if I overwrite it ?