给定 player
的最近一次 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.GetLastPing(Network.connections[i]) + " ms");
i++;
}
}
}