Enable DTLS encryption
Configure your Relay client to use Datagram Transport Layer Security for encrypted connections.
読み終わるまでの所要時間 1 分最終更新 2日前
Relay supports DTLS encryption of all UDP communication to and from the Relay servers. Set the Relay server
RelayProtocolDTLS
The following code snippet shows how to create sessions with DTLS encryption:
The following code snippet shows how to join a session with DTLS encryption:using Unity.Services.Multiplayer;// As host: create a session with DTLS encryption explicitly setvar session = await MultiplayerService.Instance.CreateSessionAsync( new SessionOptions { MaxPlayers = 4 } .WithRelayNetwork() .WithNetworkOptions(new NetworkOptions { RelayProtocol = RelayProtocol.DTLS }));Debug.Log($"Session created with join code: {session.Code}");
// As client: join by code with DTLSvar session = await MultiplayerService.Instance.JoinSessionByCodeAsync( joinCode, new JoinSessionOptions() .WithNetworkOptions(new NetworkOptions { RelayProtocol = RelayProtocol.DTLS }));