From c7285e227a1caf7803a2f955b63da9d32c904418 Mon Sep 17 00:00:00 2001 From: Patrick Coglan Date: Sun, 20 Aug 2023 14:55:34 +0100 Subject: [PATCH] feat(NetworkManager): expose methods for clientId to transportId mappings --- .../Runtime/Core/NetworkManager.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs index 03076e657e..b0aab2b753 100644 --- a/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs @@ -903,6 +903,20 @@ private void HostServerInitialize() ConnectionManager.InvokeOnClientConnectedCallback(LocalClientId); } + /// + /// Get the transportId from the associated clientId. + /// + /// The ClientId to get the TransportId from + /// + public ulong GetTransportIdFromClientId(ulong clientId) => ConnectionManager.ClientIdToTransportId(clientId); + + /// + /// Get the clientId from the associated transportId. + /// + /// The TransportId to get the ClientId from + /// + public ulong GetClientIdFromTransportId(ulong transportId) => ConnectionManager.TransportIdToClientId(transportId); + /// /// Disconnects the remote client. ///