Skip to content

Commit

Permalink
fix: ListServer Ping not found in WebGL
Browse files Browse the repository at this point in the history
  • Loading branch information
miwarnec committed Apr 28, 2019
1 parent 1764c1c commit 6c4b34b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Assets/Mirror/Examples/ListServer/ListServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ 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;
//this.port = port;
this.title = title;
this.players = players;
this.capacity = capacity;
#if !UNITY_WEBGL // Ping isn't known in WebGL builds
ping = new Ping(ip);
#endif
}
}

Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit 6c4b34b

Please sign in to comment.