Having trouble getting player count on Fusion

Anyone have ideas on what I'm doing wrong, or alternatives to getting a player count from a networked session?

int playerCount = Runner.SessionInfo.PlayerCount;


int maxCount = Runner.SessionInfo.MaxPlayers;

are both returning 0 for me.

This is coming from an object with a NetworkObject component attached to an object that has a script that is a NetworkBehaviour. No console errors. They are also only called after Spawned() is called.

Any help would be greatly appreciated!


  • Hi @Hedayk ,

    Runner.SessionInfo.PlayerCount and Runner.SessionInfo.MaxPlayers are valid only for matchmaking when you are looking into sessions from a Lobby.

    On the Server, you can get the current Player count like this NetworkRunner.ActivePlayers.Count().


    Ramon Melo

    Photon Fusion Team

  • That doesn't compile, but this will new List<PlayerRef>(_runner.ActivePlayers).Count

    Not as clean and efficient as I'd like. If there's a better way, do tell!

  • Runner.ActivePlayers.Count();

    This does compile as long as you include:

    using System.Linq;