Skip to content

Commit c9b8db0

Browse files
committed
replacing usage of deprecated Relay class with RelayService
1 parent 0c2d0e7 commit c9b8db0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Packages/com.unity.multiplayer.samples.coop/Utilities/Net/UnityRelayUtilities.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
99
{
1010
public static class UnityRelayUtilities
1111
{
12-
private const string kDtlsConnType = "dtls";
12+
const string k_KDtlsConnType = "dtls";
1313

1414
public static async
1515
Task<(string ipv4address, ushort port, byte[] allocationIdBytes, byte[] connectionData, byte[] key, string
@@ -20,7 +20,7 @@ public static async
2020

2121
try
2222
{
23-
allocation = await Relay.Instance.CreateAllocationAsync(maxConnections, region);
23+
allocation = await RelayService.Instance.CreateAllocationAsync(maxConnections, region);
2424
}
2525
catch (Exception exception)
2626
{
@@ -31,14 +31,14 @@ public static async
3131

3232
try
3333
{
34-
joinCode = await Relay.Instance.GetJoinCodeAsync(allocation.AllocationId);
34+
joinCode = await RelayService.Instance.GetJoinCodeAsync(allocation.AllocationId);
3535
}
3636
catch (Exception exception)
3737
{
3838
throw new Exception($"Creating join code request has failed: \n {exception.Message}");
3939
}
4040

41-
var dtlsEndpoint = allocation.ServerEndpoints.First(e => e.ConnectionType == kDtlsConnType);
41+
var dtlsEndpoint = allocation.ServerEndpoints.First(e => e.ConnectionType == k_KDtlsConnType);
4242
return (dtlsEndpoint.Host, (ushort)dtlsEndpoint.Port, allocation.AllocationIdBytes,
4343
allocation.ConnectionData, allocation.Key, joinCode);
4444
}
@@ -50,7 +50,7 @@ public static async
5050
JoinAllocation allocation;
5151
try
5252
{
53-
allocation = await Relay.Instance.JoinAllocationAsync(joinCode);
53+
allocation = await RelayService.Instance.JoinAllocationAsync(joinCode);
5454
}
5555
catch (Exception exception)
5656
{
@@ -61,7 +61,7 @@ public static async
6161
Debug.Log($"host: {allocation.HostConnectionData[0]} {allocation.HostConnectionData[1]}");
6262
Debug.Log($"client: {allocation.AllocationId}");
6363

64-
var dtlsEndpoint = allocation.ServerEndpoints.First(e => e.ConnectionType == kDtlsConnType);
64+
var dtlsEndpoint = allocation.ServerEndpoints.First(e => e.ConnectionType == k_KDtlsConnType);
6565
return (dtlsEndpoint.Host, (ushort)dtlsEndpoint.Port, allocation.AllocationIdBytes,
6666
allocation.ConnectionData, allocation.HostConnectionData, allocation.Key);
6767
}

0 commit comments

Comments
 (0)