Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question [help] Getting MatchmakingResult before connecting to the server

Discussion in 'Matchmaker' started by unityacc275, May 16, 2023.

  1. unityacc275


    Mar 29, 2023
    Hi guys i am at a loss, i'm trying to get the match data before connecting to the server

    So far i have the matchmaking results on the server, in it i find the players and teams
    i have custom game data set on the players and one of the fields is the map we are playing
    the server then loads the right scene and readys itself to receive players

    now i'm at the stage where i want to connect to the game

    i get the ip and port from the matchmaker when a match has been found

    now im looking to get the game data from the server, either trough the matchmaking ticket or the server query before connecting to the UDP network manager, i need to be in the correct scene before i connect so it all initializas correctly

    i have scoured the web but i can't find any information on how to get the MatchmakingResult on the client side before connection to the networkmanager, how should this be done, what are my options?

    i also see a matchid returned when a match has been found but, found no way to use this...
  2. jackward84


    Jan 26, 2017
    I'm not sure if I'm doing it the official way, or correctly, but what I do is to take the IP and port that the matchmaker returned, assign it to the Transport and then call NetworkManager.Singleton.StartClient()

    In the case where a player is already connected, you'll need to first stop the client and register a callback to connect to the new match. This also means you need to be careful with other assigned OnClientStopped callbacks