how can i get my ping?

im a player in the game. how can i get my ping value?

i'll make that : if i have 100+ ping , connection lost

Network.GetAveragePing is all you need. As far as I know you can only get your own ping as client (the ping to the server, but not to other clients). However, on the server you can get it for all players.


There’s also Network.GetLastPing but it returns always the last determined ping. This value can heavily fluctuate, that’s why GetAveragePing is the better choice in most cases.

I think the easiest way from the Client to Server is to get the ping is to use the NetworkMessageInfo.TimeStamp in OnSerializeNetworkView.

Thus Network.time - messageInfo.timeStamp is the time the packet spent in transit.