Check if player is in a room

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.

Check if player is in a room

ThumbstickStudios
2016-01-09 21:34:18

Hi All,

This is probably an easy question although I can't find it on the documentation anywhere probably just blind.

My question is simple: How do I check if a PUN player is in a room? Not when he joins a room, but if he is in a room.

I want to do this as validation for a mouse lock script. I want a section in a script to run only if the player is in a room. I wish to do this on a different script for modularity.

Any solutions?

Comments

vadim
2016-01-11 09:00:23

Hi,

PhotonNetwork.inRoom returns true if client is connected to a room.

Back to top