Can't get ping for all regions

I've override `OnRegionListReceived` from `MonoBehaviourPunCallbacks` class, I can get all regions but almost all of them wasn't pinged. Only the best region I've connected was pinged. Whats I can do to get all regions ping?

Comments

  • L3sc
    L3sc
    edited September 2020
    Can you try like this?
     public override void OnRegionListReceived(RegionHandler regionHandler)
        {
            regionHandler.PingMinimumOfRegions(PingCompleteCallback, "");
        }
    
        void PingCompleteCallback(RegionHandler regionHandler)
        {
           //Ping result about to all regions
            List<Photon.Realtime.Region> regions = regionHandler.EnabledRegions;
            foreach (var region in regions)
            {
            	Debug.Log(region.Ping);
            }
    
            //Region with lowest ping
            Debug.Log(regionHandler.BestRegion.Code + " " + regionHandler.BestRegion.Ping);
    
           }
    

    This callback probably returning best ping result.
  • Yes, I've try it, as I said I was override `OnRegionListReceived` function but when get ping from regions each ping value is int.MaxValue except the best region.
  • I can fix ping problem by `ServerSettings.ResetBestRegionCodeInPreferences()` before connect to best cloud server.

    About best cloud server connection, when connecting to best cloud server, it will connect to name server.
    Then when connect to name server it will pinging all regions
    If `PUNCloudBestRegion` not existed, if it's existed it will not ping all regions.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Insthync,

    Why do you need/want to ping ALL regions (every time)?
    Maybe there is a misunderstanding of how best region works and how it's determined.
    Read more here.
  • Players might want to play with other players from difference regions, and they may want to see other region's ping to decide to connect. It's does not have to ping everytime, just once when start a game is okay. Only way to get regions list is to connect to best cloud region, but when connect to best cloud region, only best cloud region is pingged maybe because it was stored in reference when `ServerSettings.ResetBestRegionCodeInPreferences()` it will re-ping all regions.