Skip to content

Commit 99b9a79

Browse files
committed
Simplify scripting defines in UnityTransport.GetEndpoint
1 parent f5f1c1b commit 99b9a79

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

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

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,31 +1294,6 @@ public override ulong GetCurrentRtt(ulong clientId)
12941294
return (ulong)ExtractRtt(ParseClientId(clientId));
12951295
}
12961296

1297-
#if UTP_TRANSPORT_2_0_ABOVE
1298-
/// <summary>
1299-
/// Provides the <see cref="NetworkEndpoint"/> for the NGO client identifier specified.
1300-
/// </summary>
1301-
/// <remarks>
1302-
/// - This is only really useful for direct connections.
1303-
/// - Relay connections and clients connected using a distributed authority network topology will not provide the client's actual endpoint information.
1304-
/// - For LAN topologies this should work as long as it is a direct connection and not a relay connection.
1305-
/// </remarks>
1306-
/// <param name="clientId">NGO client identifier to get endpoint information about.</param>
1307-
/// <returns><see cref="NetworkEndpoint"/></returns>
1308-
public NetworkEndpoint GetEndpoint(ulong clientId)
1309-
{
1310-
if (m_Driver.IsCreated && NetworkManager != null && NetworkManager.IsListening)
1311-
{
1312-
var transportId = NetworkManager.ConnectionManager.ClientIdToTransportId(clientId);
1313-
var networkConnection = ParseClientId(transportId);
1314-
if (m_Driver.GetConnectionState(networkConnection) == NetworkConnection.State.Connected)
1315-
{
1316-
return m_Driver.GetRemoteEndpoint(networkConnection);
1317-
}
1318-
}
1319-
return new NetworkEndpoint();
1320-
}
1321-
#else
13221297
/// <summary>
13231298
/// Provides the <see cref="NetworkEndpoint"/> for the NGO client identifier specified.
13241299
/// </summary>
@@ -1337,12 +1312,15 @@ public NetworkEndpoint GetEndpoint(ulong clientId)
13371312
var networkConnection = ParseClientId(transportId);
13381313
if (connectionExists && m_Driver.GetConnectionState(networkConnection) == NetworkConnection.State.Connected)
13391314
{
1315+
#if UTP_TRANSPORT_2_0_ABOVE
1316+
return m_Driver.GetRemoteEndpoint(networkConnection);
1317+
#else
13401318
return m_Driver.RemoteEndPoint(networkConnection);
1319+
#endif
13411320
}
13421321
}
13431322
return new NetworkEndpoint();
13441323
}
1345-
#endif
13461324

13471325

13481326
/// <summary>

0 commit comments

Comments
 (0)