The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How do I make a "Players Online" count in a lobby?

2022-04-01 18:01:47


I am currently using Photon PUN to make a multiplayer game in unity. However, while making the menu, I thought it would be really cool to have a counter showing how many players were online and using the app. I looked all over the internet and could not find anything. Can anyone help me with this?

I don't need any GUI scripts or anything, just a way to find how many people are using the app at a time using C#. Thanks!


2022-04-02 10:02:25

int playersOnline = PhotonNetwork.PlayerList.Length;

2022-04-02 10:05:02

Also get the players names. You would have to assign each player a NickName over the network though

foreach(Player player in PhotonNetwork.PlayerList)




2022-04-03 17:47:45

would that count how many people are using the app or just how many people are in a room/lobby?

2022-04-04 12:01:52

Better use PhotonNetwork.CountOfPlayer.

The xml doc comment in the code tells you: "The count of players currently using this application (available on MasterServer in 5sec intervals)."

Back to top