How can I get all the players in session include the host

In my project I’m using the advanced session plugin and I wanted to create a party. How can I detect all the players that are in the session to appear later in a vertical box.


There are a couple of common ways:

  1. One way is to just use the “Player Array” variable contained in the GameState. This will give you access to the list of all PlayerStates currently in the server.
  2. Another way is to make a new variable array of PlayerControllers in your GameMode and then you just manually add and remove PlayerControllers whenever there is a PostLogin or a Disconnect.
1 Like

I am not getting it just to see the name of the player himself, the rest does not appear even if they are already in session or if they re-enter basically what seems to me is that the players of matrices in the game are just Have the player himself , do not know.

Yeah for my problem I would do a server travel then on begin play I would grab the player array and it seemed on the client I would never get the host. However, for testing purposes I put it on tick and then I would get the host soon after.

I ended up going with option 2. What I did was added the PlayerController to a TArray on the GameMode then I would go into the PlayerController and update a TArray that contained all the players that have logged on. The PlayerController also had a repnotify which would then update my widgets on the client. Works for what I need it to do.