I been stuck on this one problem in my Lan multiplayer game. Im trying to make it so when a player joins the selected server it will refresh the player list across all connected clients. Any tip on how i can get this to work?
.
This is suppose to call the update function when a player join the selected server
[1]:
You don’t have a lot here to go on. The two screenshots aren’t linking this back to where you want to call this from. Or were you looking for ideas on where to call these from? If so, my suggestion would either be from the Player Controller, which isn’t the best spot, but doable in it’s BeginPlay. The much better spot would probably be in your GameMode. There’s an event called OnPostLogin. This should fire after a player has joined and been assigned a player controller. Good place to update a menu I would assume.
I store all the info about the player that the player list would need, inside my custom PlayerState class (my custom GameMode class is set to use that PlayerState class too).
When the PlayerState enters the level after being constructed, it fires its BeginPlay event.
I usually trigger these kinds of updates from there. If the client needs to supply something like client-side savegame data first, then I’ll trigger on when that is completed, and pass the information up to the server. When the server has finished updating its copy of the playerstate, then it fires an update to all Clients to update their player list.
Thanks a lot, Your approach did really help me out to fix the issue. I really needed to do something to get me out of this problem with fine solution.
Regards,
I’m glad I could help. If my answer is the one you used, please click the checkmark icon in the top left corner of the answer to mark it as the Accepted answer, which helps others looking for help with the same thing.