Password

Options
how to set password for game/room?

Comments

  • Tobias
    Options
    You cant.
    Not in the Unity Networking Plugin. It could be added to the room logic, if really needed.

    You can hide rooms and close them. If you hide a room, the name of it more or less becomes a password (no one knows). Avoid random matchmaking in that case.
  • seonr
    Options
    Is this still the case? I have been lolling for a password option in PUN (1.9.6) and can't see anything.
  • dreamora
    Options
    Its still the case.
    If you want a password and don't want to toy with the Photon LoadBalancing code, you would have to handle that yourself on the master client through an RPC for example
  • Tobias
    Options
    There are 2 ways to do this:
    a) Use the server SDK's Loadbalancing application and add this feature.
    b) Encode the pw and add it as property to the room. Clients that see a room has a pw, will get user input, encode and compare with the room's property before joining the room. Of course, this is a put client side solution but simpler.
  • seonr
    Options
    It's ok, I implemented your suggestion (Tobias) of hidden rooms, works really well actually :-)

    If the user sets a password, i make the room hidden and name the room the password name, then on the joining client, the user types in a password and it looks for and joins that room.

    Working really well... way better than I expected :-)

    I LOVE PHOTON!
  • Kaiserludi
    Options
    seonr wrote:
    It's ok, I implemented your suggestion (Tobias) of hidden rooms, works really well actually :-)

    If the user sets a password, i make the room hidden and name the room the password name, then on the joining client, the user types in a password and it looks for and joins that room.

    Working really well... way better than I expected :-)

    I LOVE PHOTON!
    The downside of this approach would be, that two users can't use the same pw at the same time. However you could eliminate this problem by naming the room userNamePassword or gameNamePassword instead of just password. Of course in this case the joining clients always have to know the username of the game creator or the name of the game room and not only the pw.
  • Tobias
    Options
    Working really well... way better than I expected :-)
    I LOVE PHOTON!

    :D
  • liorium
    Options
    Hello @Tobias admin

    i have made custom room properties for password. and then how to access it? I write below code :

    if(inputPass.text == PhotonNetwork.room.CustomProperties["pass"].tostring())
    {
    Photonnetwork.Joinroom(name);
    }

    but photonnetwork.room is for current room we are inside right?

    if i'm in lobby, how to do that?