[Unity 5]配对:匹配不可见

时间:2016-01-08 12:31:15

标签: unity3d unity-networking matchmaking

我需要你的帮助,因为我有关于配对的问题。我尝试在网上制作一个Pong可玩的。当我使用NetworkHUD,并且我使用Matchmaker时,我可以创建一个匹配项,而另一个应用程序(现在在同一台计算机上)将其分离并可以加入它。但是,当我不使用它时,我手动使用红娘,我可以创建一个匹配,我有一个成功的响应,我可以在同一个应用程序中找到这个匹配,但是,在我的第二个应用程序中,我可以&# 39;找到第一个应用程序创建的匹配。

你能帮助我吗?

以下是我创建匹配的两个函数:

 public void matchmaking()
     {
         nm.StartMatchMaker();
         networkMatch.ListMatches(0, 20, "", OnMatchList);
         Debug.LogError ("NBR MATCH " +matchList.Count);
         if (matchList.Count == 0)
         {
             CreateMatchRequest match = new CreateMatchRequest();
             match.name = "OrionPongRoom";
             match.size = 2;
             match.advertise = true;
             match.password = "";
             networkMatch.CreateMatch(match, OnMatchCreate);
         }
         else
             Debug.Log ("******matches found"+matchList.Count);
     }
    void OnMatchCreate(CreateMatchResponse matchResponse)
 {
     if (matchResponse.success)
     {
         Debug.LogError("Create match succeeded");
         matchCreated = true;
         MatchInfo matchInfo = new MatchInfo(matchResponse);
         Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));
         nm.StartHost(matchInfo);
         NetworkServer.Listen(9000);
         //NetworkServer.Listen(new MatchInfo(matchResponse), 9000);
     }
     else
     {
         Debug.LogError ("Create match failed");
     }
 }

1 个答案:

答案 0 :(得分:1)

你需要写

$digest
if (matchList.Count == 0) { CreateMatchRequest match = new CreateMatchRequest(); match.name = "OrionPongRoom"; match.size = 2; match.advertise = true; match.password = ""; networkMatch.CreateMatch(match, OnMatchCreate); } else Debug.Log ("******matches found"+matchList.Count); 方法中的

OnMatchList

由于Network Delays等,匹配服务器无法同步发送响应。

相关问题