From 6b7f865461ebdc6a98e043f232f6087524575f68 Mon Sep 17 00:00:00 2001 From: Simon Lemay Date: Tue, 4 Oct 2022 16:52:25 -0400 Subject: [PATCH 1/3] feat: Add new SetRelayServerData method to UnityTransport --- com.unity.netcode.gameobjects/CHANGELOG.md | 1 + .../Runtime/Transports/UTP/UnityTransport.cs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index f007ab7831..8be918298d 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -11,6 +11,7 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Added +- `UnityTransport` now provides a way to set the Relay server data directly from the `RelayServerData` structure (provided by the Unity Transport package) throuh its `SetRelayServerData` method. This allows making use of the new APIs in UTP 1.3 that simplify integration of the Relay SDK. - IPv6 is now supported for direct connections when using `UnityTransport`. (#2232) - Added WebSocket support when using UTP 2.0 with `UseWebSockets` property in the `UnityTransport` component of the `NetworkManager` allowing to pick WebSockets for communication. When building for WebGL, this selection happens automatically. (#2201) diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index dbbd8dd0c4..ed480e3d6d 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -607,6 +607,14 @@ public void SetRelayServerData(string ipv4Address, ushort port, byte[] allocatio SetProtocol(ProtocolType.RelayUnityTransport); } + /// Set the relay server data (using the lower-level Unity Transport data structure). + /// Data for the Relay server to use. + public void SetRelayServerData(ref RelayServerData serverData) + { + m_RelayServerData = serverData; + SetProtocol(ProtocolType.RelayUnityTransport); + } + /// Set the relay server data for the host. /// IP address of the relay server. /// UDP port of the relay server. From 372253bc8f30d3e0dfe1e0262350d2f72aa63b00 Mon Sep 17 00:00:00 2001 From: Simon Lemay Date: Tue, 4 Oct 2022 16:57:39 -0400 Subject: [PATCH 2/3] Don't pass server data by reference --- .../Runtime/Transports/UTP/UnityTransport.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index ed480e3d6d..7ebf3c5dd1 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -609,7 +609,7 @@ public void SetRelayServerData(string ipv4Address, ushort port, byte[] allocatio /// Set the relay server data (using the lower-level Unity Transport data structure). /// Data for the Relay server to use. - public void SetRelayServerData(ref RelayServerData serverData) + public void SetRelayServerData(RelayServerData serverData) { m_RelayServerData = serverData; SetProtocol(ProtocolType.RelayUnityTransport); From ef7bc563fdf8c3359589bc2f604c54f223fe67fd Mon Sep 17 00:00:00 2001 From: Simon Lemay Date: Tue, 4 Oct 2022 17:10:47 -0400 Subject: [PATCH 3/3] Add PR number to CHANGELOG entry --- com.unity.netcode.gameobjects/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index 8be918298d..df5ce8bbd9 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -11,7 +11,7 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Added -- `UnityTransport` now provides a way to set the Relay server data directly from the `RelayServerData` structure (provided by the Unity Transport package) throuh its `SetRelayServerData` method. This allows making use of the new APIs in UTP 1.3 that simplify integration of the Relay SDK. +- `UnityTransport` now provides a way to set the Relay server data directly from the `RelayServerData` structure (provided by the Unity Transport package) throuh its `SetRelayServerData` method. This allows making use of the new APIs in UTP 1.3 that simplify integration of the Relay SDK. (#2235) - IPv6 is now supported for direct connections when using `UnityTransport`. (#2232) - Added WebSocket support when using UTP 2.0 with `UseWebSockets` property in the `UnityTransport` component of the `NetworkManager` allowing to pick WebSockets for communication. When building for WebGL, this selection happens automatically. (#2201)