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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Set the MatchInfoSnapshot when creating a match?

Discussion in 'Multiplayer' started by Crizz92, Sep 30, 2016.

  1. Crizz92

    Crizz92

    Joined:
    Sep 17, 2015
    Posts:
    44
    Hi everyone!

    I would like to know if there is a way to change the MatchInfoSnapshot when we create a match. I would like to change the matchAttributes of MatchInfoSnapshot to personnalize the matchmaking depending on matchAttributes when retrieving the list of matchs. MatchInfo is not what i need so...

    Code (CSharp):
    1.     //call this method to request a match to be created on the server
    2.     public void CreateInternetMatch(string matchName)
    3.     {
    4.         NetworkManager.singleton.matchMaker.CreateMatch(matchName, 4, true, "", "", "", 0, 0, OnInternetMatchCreate);
    5.     //set MatchInfoSnapshot?
    6.     }
    7.  
    8.     //this method is called when your request for creating a match is returned
    9.     private void OnInternetMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
    10.     {
    11.         if (success)
    12.         {
    13.             MatchInfo hostInfo = matchInfo;
    14.             NetworkServer.Listen(hostInfo, 9000);
    15.            
    16.             NetworkManager.singleton.StartHost(hostInfo);
    17.         }
    18.         else
    19.         {
    20.             Debug.LogError("Create match failed");
    21.         }
    22.     }
    Thanks for the answer!
     
  2. Crizz92

    Crizz92

    Joined:
    Sep 17, 2015
    Posts:
    44
    None know how to set the match attribute?