Skip to main content

PingDisplay

A class in Root.Township, Alta.Utilities.Profiling.

Client live data display showing the transport ping to the server and the game-level ping from PingMessage.

Constructors​

MemberWhat it is
PingDisplay()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

5 private and internal fields
MemberWhat it is
private const int DecimalPlacesConstant 4, the rounding used in the output.
private float gamePingLast game ping from PingMessage.LastPingInSeconds.
private const string GamePingTitleLabel for the game ping line.
private bool? isLocalPlayerCached once from PlayerController.Current; pinging only runs when true.
private float pingLast transport ping result.

Properties​

MemberWhat it is
override string Output { get; }Both ping lines. Both say ms, but the game ping comes from PingMessage.LastPingInSeconds.
protected override string Title { get; }"Ping".

Methods​

MemberWhat it is
override void InternalUpdate(LiveDataDisplayView coroutineRunner)For the local player, pings the first socket connection and sends a Ping message to all, then reads the last game ping.
protected override string GetData()Returns null; Output is overridden instead.
3 private and internal methods
MemberWhat it is
private string CustomOutput()Formats both ping values to 4 decimal places.
private void Ping(MonoBehaviour coroutineRunner)Starts a ping coroutine on the first connection of the current socket.
private void UpdatePing(float ping)Callback that stores the transport ping result.