Skip to content

Commit cf695a5

Browse files
feat: Add new SetRelayServerData method to UnityTransport (#2235)
* feat: Add new SetRelayServerData method to UnityTransport * Don't pass server data by reference * Add PR number to CHANGELOG entry
1 parent d00ddb9 commit cf695a5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
1111

1212
### Added
1313

14+
- `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)
1415
- IPv6 is now supported for direct connections when using `UnityTransport`. (#2232)
1516
- 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)
1617
- Added position, rotation, and scale to the `ParentSyncMessage` which provides users the ability to specify the final values on the server-side when `OnNetworkObjectParentChanged` is invoked just before the message is created (when the `Transform` values are applied to the message). (#2146)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,14 @@ public void SetRelayServerData(string ipv4Address, ushort port, byte[] allocatio
622622
SetProtocol(ProtocolType.RelayUnityTransport);
623623
}
624624

625+
/// <summary>Set the relay server data (using the lower-level Unity Transport data structure).</summary>
626+
/// <param name="serverData">Data for the Relay server to use.</param>
627+
public void SetRelayServerData(RelayServerData serverData)
628+
{
629+
m_RelayServerData = serverData;
630+
SetProtocol(ProtocolType.RelayUnityTransport);
631+
}
632+
625633
/// <summary>Set the relay server data for the host.</summary>
626634
/// <param name="ipAddress">IP address of the relay server.</param>
627635
/// <param name="port">UDP port of the relay server.</param>

0 commit comments

Comments
 (0)