Skip to content

Commit 6353f59

Browse files
feat: Log errors when Relay/WebSocket settings are mismatched (#2715)
Co-authored-by: Noel Stephens <[email protected]>
1 parent b50b396 commit 6353f59

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,21 @@ public void CreateDriver(UnityTransport transport, out NetworkDriver driver,
15621562
}
15631563
#endif
15641564

1565+
#if UTP_TRANSPORT_2_1_ABOVE
1566+
if (m_ProtocolType == ProtocolType.RelayUnityTransport)
1567+
{
1568+
if (m_UseWebSockets && m_RelayServerData.IsWebSocket == 0)
1569+
{
1570+
Debug.LogError("Transport is configured to use WebSockets, but Relay server data isn't. Be sure to use \"wss\" as the connection type when creating the server data (instead of \"dtls\" or \"udp\").");
1571+
}
1572+
1573+
if (!m_UseWebSockets && m_RelayServerData.IsWebSocket != 0)
1574+
{
1575+
Debug.LogError("Relay server data indicates usage of WebSockets, but \"Use WebSockets\" checkbox isn't checked under \"Unity Transport\" component.");
1576+
}
1577+
}
1578+
#endif
1579+
15651580
#if UTP_TRANSPORT_2_0_ABOVE
15661581
if (m_UseWebSockets)
15671582
{

com.unity.netcode.gameobjects/Runtime/com.unity.netcode.runtime.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
"name": "com.unity.transport",
3737
"expression": "2.0.0-exp",
3838
"define": "UTP_TRANSPORT_2_0_ABOVE"
39+
},
40+
{
41+
"name": "com.unity.transport",
42+
"expression": "2.1.0",
43+
"define": "UTP_TRANSPORT_2_1_ABOVE"
3944
}
4045
]
4146
}

0 commit comments

Comments
 (0)