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
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 setup photon room code join system

kannan
2021-06-18 09:57:02

How to setup photon room code join system:
i want to allow the user to join only if he have room code for the game to join. how to do this?

Comments

JohnTube
2021-06-18 10:49:55

Hi @kannan,

Please search the documentation and the forum or the internet before starting a new discussion.

By default you can create rooms hidden (roomOptions.IsVisible = false) and let Photon Server assign a GUID as room name (or GameId) that you can share with friends via Photon Chat, social networks or any other mean (third party service or your own custom service). Friends can then join the room by name using PhotonNetwork.JoinRoom.

If you want to have control (format, length, etc.) over the room name (code to share), see here and here.

If the room should be joined only by specific players knowing their UserId then you could make use of ExpectedUsers (Slots Reservation). If not, you can try to kick unwanted players from Master Client using PhotonNetwork.CloseConnection. Otherwise you would need a custom server plugin or custom server side logic. Both options are not available on the public cloud.

Back to top