netId | 加わるマッチのネットワーク ID。これは、NetworkMatch.ListMatches を呼び出し、返されたマッチのリストから結果を取得して見つけます。 |
matchPassword | The password of the match. Leave empty if there is no password for the match, and supply the text string password if the match was configured to have one of the NetworkMatch.CreateMatch request. |
publicClientAddress | オプションのパブリックのクライアントアドレス。この値はマッチメーカーに格納され、マッチにリストしているクライアントに与えられます。これは、クライアントがインターネット経由で直接接続するためのネットワークアドレスです。その他の方法として、空の文字列を渡しても、マッチメーカーと接続したり、リレーサーバーを使用する機能に影響することはありません。 |
privateClientAddress | オプションのプライベートのクライアントアドレス。この値はマッチメーカーに格納され、マッチにリストしているクライアントに与えられます。これは、クライアントが LAN 経由で直接接続するためのネットワークアドレスです。その他の方法として、空の文字列を渡しても、マッチメーカーと接続したり、リレーサーバーを使用する機能に影響することはありません。 |
eloScoreForClient | 作成されたマッチをホスティングするクライアントの Elo スコア。この数値がすべてのクライアントで相対的なスキルレベルを示すように設定されている場合、この数値は、プレイヤーのスキルレベルをリストした場合のプレイに最も適した順序でマッチを返すために使用されます。すべてのクライアントでこの値が 0 の場合は、マッチメーカーで Elo の算出は不可能になります。 |
requestDomain | このリクエストのリクエストドメイン。同じドメインのリクエストのみが互いに連動します。例えば、NetworkMatch.CreateMatch がドメイン 1 で作成された場合、ドメイン 1 を指定する ListMatches のみがそのマッチを見つけます。この値は、異なる (互換性がない場合もある) クライアントバージョンを区別するために使用します。 |
callback | 呼び出しが完了すると発生するコールバック |
Coroutine この関数は非同期で、コルーチンがサービスバックエンドとの通信を終了したある時点で完了します。
マッチメーカーに現在のクライアントが特定のマッチに加わりたいことを伝えるための関数。
この関数は、NetworkMatch.ListMatches の呼び出しから結果を取得し、加わるマッチを選んでから呼び出されます。このリクエストを受け取ると、MatchMaker はこのマッチが通信するリレーサーバーのシートを確保し、このクライアントがリレーサーバーに接続するために必要な情報をフェッチします。いったん、callback が終了すると、このクライアントが選択したマッチに接続するのに必要なものがそろいます。接続するには、MatchInfo に渡された情報で StartClient() を呼び出します。
using UnityEngine; using UnityEngine.Networking; using UnityEngine.Networking.Match; using UnityEngine.Networking.Types;
public class ExampleScript : MonoBehaviour { public NetworkID netId;
void Start() { NetworkManager.singleton.StartMatchMaker(); NetworkManager.singleton.matchMaker.JoinMatch(netId, "" , "", "", 0, 0, OnMatchJoined); }
public void OnMatchJoined(bool success, string extendedInfo, MatchInfo matchInfo) { // ... } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.