How to know if player connected to server

The whole answer can be found below.

Please note: 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! And we offer you support through these channels:

Try Our
Documentation

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.

Read More on
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 to know if player connected to server

uzu
2017-02-11 19:58:15

I'm trying to tell a plyer that other player connected to server, so they can make a mathch
(my game is having a cute amount of ccu 2~4). so,
any ways??

Comments

artourky
2017-02-12 15:05:43

if(PhotonNetwork.connected)
{
// it's connected on MasterServer
}

[Deleted User]
2017-02-13 14:12:57

Hi @uzu,

if your player is in the lobby he can regularly check PhotonNetwork.countOfPlayersOnMaster to see the current player count in the lobby (if autoJoinLobby property is set to true) or the master server.

If one of your clients already has joined a room you can use OnPhotonPlayerConnected(PhotonPlayer newPlayer) callback to respond to joining players.

Back to top