Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    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?