私は DOTsSample Unity プロジェクトを使用しようとしており、この NetworkStatistics クラス ( https://github.com/Unity-Technologies/DOTSSample/blob/master/Assets/Scripts/Game/Main/NetworkStatisticsClient.cs )を使用したいと考えています。ゲームのネットワーク統計を表示するスクリプトを作成する必要がありますが、問題は常に 0 を返すことです。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NetStats : MonoBehaviour
{
// Start is called before the first frame update
NetworkStatisticsClient networkStatisticsClient;
private SocketTransport m_Transport;
private NetworkClient m_NetworkClient;
void Start()
{
m_Transport = new SocketTransport();
m_Transport.Connect("127.0.0.1",80);
m_NetworkClient = new NetworkClient(m_Transport);
if (Application.isEditor || Game.game.buildId == "AutoBuild")
NetworkClient.clientVerifyProtocol.Value = "0";
m_NetworkClient.UpdateClientConfig();
networkStatisticsClient = new NetworkStatisticsClient(m_NetworkClient);
}
// Update is called once per frame
void Update()
{
//Client isConnected is False thus, the connection is not establishment is not correct
Debug.Log("Rtt: " + m_NetworkClient.isConnected + networkStatisticsClient.rtt.average);
}
}
誰でもこれで私を助けてもらえますか?