Search Unity

Matchmaker state

Discussion in 'Multiplayer' started by Sbizz, Jun 11, 2015.

  1. Sbizz

    Sbizz

    Joined:
    Oct 2, 2014
    Posts:
    250
    Hey.

    I'm trying to do a little game and I'm trying to do it with Unity 5.1.

    So my first goal is to create a Start Menu with a list of servers available, the possibility of creating / joining a game, etc.

    When I start my scene, my manager call NetworkManager.singleton.StartMatchMaker().
    The thing is, I didn't find on the Unity's documentation or in the sample projects a way to know when we have reach (or not) the MatchMaker, if it is still alive etc.

    I found several events like OnStartServer(), OnStartClient(), OnStartHost().. but no OnMatchMakerStart().

    Code (CSharp):
    1.         void Start() {
    2.             NetworkManager.singleton.StartMatchMaker();
    3.             NetworkManager.singleton.matchMaker.ListMatches(0, 20, "", OnMatchList);
    4.         }
    5.  
    This works.. but If the MatchMaker crashes, I have no events to tell me "Hey dude, I'm not here anymore, bye bye". The only thing I noticed is that the NetworkManager.singleton.matchMaker is null when we're not connected.. I'd like to be informed about that. I could do that in a Update function : checking if the matchMaker is null or not.. but it's really ugly :p

    Thank you !