给定/玩家/的最近平均 ping 时间(毫秒)
如果无法找到玩家,则返回 -1。 ping 指令每隔数秒自动发送。
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void OnGUI() {
GUILayout.Label("Player ping values");
int i = 0;
while (i < Network.connections.Length) {
GUILayout.Label("Player " + Network.connections[i] + " - " + Network.GetAveragePing(Network.connections[i]) + " ms");
i++;
}
}
}