Network.GetAveragePing Manual     Reference     Scripting  
Scripting > Runtime Classes > Network
Network.GetAveragePing

static function GetAveragePing (player : NetworkPlayer) : int

Description

The last average ping time to the given player in milliseconds.

If the player can't be found -1 will be returned. Pings are automatically sent out every couple of seconds.

function OnGUI() {
var i: int;
GUILayout.Label("Player ping values");
for (i=0; i < Network.connections.length; i++) {
GUILayout.Label("Player " +
Network.connections[i] + " - " +
Network.GetAveragePing(Network.connections[i]) + " ms");
}
}