Regions Ping Always 0

Options
Elias
Elias
I'm connecting to the NameServer to get a list of all severs and list it to the player with each current ping, but the ping value that i get is always 0.

public override void Show(bool p_show)
    {
        foreach (Region __region in PhotonNetwork.networkingPeer.AvailableRegions)
        {
            RegionBar __regionBar = Instantiate(regionBarPrefab);

            __regionBar.regionLabel.text = __region.Code.ToString();
            __regionBar.pingLabel.text = "Ping: " + __region.Ping; //Always 0
            __regionBar.region = __region;
            
            __regionBar.transform.SetParent(regionBarGrid.transform);

            _regionBars.Add(__regionBar);
        }

        base.Show(p_show);

        _displaying = true;
    }

void Update()
    {
        if (!_displaying)
            return;
        
        foreach (RegionBar __regionBar in _regionBars)
        {
            __regionBar.pingLabel.text = "Ping: " + __regionBar.region.Ping;  //Always 0
        }
    }
What am i doing wrong, do i have to manually send a ping command ? If so, how do i do this ?

Comments

  • Elias
    Options
    Found it, if any one have this same problem here's the answer:

    You have to manually start the ping routine.

    StartCoroutine(PhotonHandler.SP.PingAvailableRegionsCoroutine(false));
  • mrm83
    mrm83
    edited September 2016
    Options
    I get this error when i try to connect to name server

    Operation failed: OperationResponse 220: ReturnCode: -2 (Missing value 224 (GetRegionListRequest.ApplicationId)
    ). Parameters: {} Server: NameServer
    UnityEngine.Debug:LogError(Object)
    NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1420)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)

    GetRegions failed. Can't provide regions list. Error: -2: Missing value 224 (GetRegionListRequest.ApplicationId)

    UnityEngine.Debug:LogError(Object)
    NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1585)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)
  • Tobias
    Options
    224 is ApplicationId. This means you didn't set a AppId, most likely.
    Get it from the dashboard and apply it to the client before connecting.