mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix: ListServer Ping not found in WebGL
This commit is contained in:
parent
1764c1c9dd
commit
6c4b34ba06
@ -18,8 +18,9 @@ public class ServerStatus
|
||||
public ushort capacity;
|
||||
|
||||
public int lastLatency = -1;
|
||||
#if !UNITY_WEBGL // Ping isn't known in WebGL builds
|
||||
public Ping ping;
|
||||
|
||||
#endif
|
||||
public ServerStatus(string ip, /*ushort port,*/ string title, ushort players, ushort capacity)
|
||||
{
|
||||
this.ip = ip;
|
||||
@ -27,7 +28,9 @@ public ServerStatus(string ip, /*ushort port,*/ string title, ushort players, us
|
||||
this.title = title;
|
||||
this.players = players;
|
||||
this.capacity = capacity;
|
||||
#if !UNITY_WEBGL // Ping isn't known in WebGL builds
|
||||
ping = new Ping(ip);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,6 +204,7 @@ void TickClient()
|
||||
Debug.Log("[List Server] Client disconnected.");
|
||||
}
|
||||
|
||||
#if !UNITY_WEBGL // Ping isn't known in WebGL builds
|
||||
// ping again if previous ping finished
|
||||
foreach (ServerStatus server in list.Values)
|
||||
{
|
||||
@ -210,6 +214,7 @@ void TickClient()
|
||||
server.ping = new Ping(server.ip);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// otherwise try to connect
|
||||
// (we may have just joined the menu/disconnect from game server)
|
||||
|
Loading…
Reference in New Issue
Block a user