Version: 2020.2
언어: 한국어
Method group is Obsolete

NetworkMatch.JoinMatch

매뉴얼로 전환
Obsolete public Coroutine JoinMatch (Networking.Types.NetworkID netId, string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForClient, int requestDomain, DataResponseDelegate<MatchInfo> callback);

파라미터

netId The NetworkID of the match to join. This is found through calling NetworkMatch.ListMatches and picking a result from the returned list of matches.
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 The optional public client address. This value will be stored on the matchmaker and given to other clients listing matches. You should send this value if you want your players to be able to connect directly with each other over the internet. Alternatively you can pass an empty string and it will not affect the ability to interface with matchmaker or use relay server.
privateClientAddress The optional private client address. This value will be stored on the matchmaker and given to other clients listing matches. You should send this value if you want your players to be able to connect directly with each other over a Local Area Network. Alternatively you can pass an empty string and it will not affect the ability to interface with matchmaker or use relay server.
eloScoreForClient The Elo score for the client joining the match being created. If this number is set on all clients to indicate relative skill level, this number is used to return matches ordered by those that are most suitable for play given a listing player's skill level. This may be 0 on all clients, which would disable any Elo calculations in the MatchMaker.
requestDomain The request domain for this request. Only requests in the same domain can interface with each other. For example if a NetworkMatch.CreateMatch is made with domain 1, only ListMatches that also specify domain 1 will find that match. Use this value to silo different (possibly incompatible) client versions.
callback The callback to be invoked when this call completes.

반환

Coroutine This function is asynchronous and will complete at some point in the future, when the coroutine has finished communicating with the service backend.

설명

The function used to tell MatchMaker the current client wishes to join a specific match.

This function should be called after getting results from a call to NetworkMatch.ListMatches and picking a match to join. Upon receiving this request, the MatchMaker will reserve a seat on the Relay server this match is talking through and fetch the info needed for this client to connect to that Relay server. Once the callback completes, this client will have the necessary to continue connecting to the chosen match. To do so you then should call StartClient() with the passed in MatchInfo.

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) { // ... } }