Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Unity Multiplayer Matchmaker state

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

  1. Sbizz


    Oct 2, 2014

    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.         }
    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 !