Unity Netcode for gameobjects with relay - calculate ping
Asked Answered
A

1

6

I am having trouble calculating the ping of players in Netcode. I have a list of lobbies, and I want to display the expected ping of each of them, before the client connects. Currently, I am using NetworkManager.Singleton.NetworkConfig.NetworkTransport.GetCurrentRtt(0); to calculate the ping. Is there a way to know the ping before connecting to the relay fully?

Andradite answered 5/5, 2022 at 11:40 Comment(0)
S
-1

One option would be to run pings outside of the Network Managers

Microsoft has an example of their ping here

You could ping the host to show the ping before the player tries to connect.

Sunda answered 14/5, 2022 at 1:6 Comment(2)
Hey, the problem is I am connecting through relay, so the ping is more complicated than that, since I connect to the relay server and then the relay connects to the client, pinging peer to peer only won't be enough right?Andradite
Ahh. Sorry. I'm thinking old netcode. (Why the kept the same name ughh) I think you should be able to ping the relay service. Unsure how reliable that would be. Sorry I'm unsure how to be of more help. Might be best to email unity or look at their docs.Sunda

© 2022 - 2024 — McMap. All rights reserved.