Search Unity

[SOLVED] How to know if match has password?

Discussion in 'Multiplayer' started by Rodolfo-Rubens, Mar 4, 2017.

  1. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    When retrieving a list from NetworkMatch.ListMatches, the MatchInfoSnapshots doesn't have any info if that match has a password, I want to show on the matches list entry a ladlock icon in the left if that match has password.
    Also, before call JoinMatch I need to know if I'm going to show a password field to the client right? How am I going to do this if the client don't know if the match has a password or not?
     
  2. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    MatchInfoSnapshot actually has an isPrivate property that you can use for this.
     
    Rodolfo-Rubens likes this.
  3. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    I thought that isPrivate was for matches hidden from the match list, putting a password make it private? Is it the same thing?
     
  4. gamevanilla

    gamevanilla

    Joined:
    Dec 28, 2015
    Posts:
    968
    The documentation for the isPrivate property is a bit confusing on that regard, but the one for ListMatches says private matches are those that are password protected and whether they are returned or not depends on the filterOutPrivateMatchesFromResults flag. I certainly use isPrivate myself for the very same purpose you mention (showing a lock and a password dialog for the private matches).
     
    Rodolfo-Rubens likes this.
  5. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Ah, that's great! Thanks a lot! I would never know that, I really thought that isPrivate was something else, they need to explain this in the documentation. Thanks!
     
    gamevanilla likes this.