Skip to main content
Version: 5.11.8

Latency

public Latency Latency();

Description

Checks the latency between the in-game server and the client.

  • Generally, latency of 50 ms or less is measured.
  • The latency of the match server is not provided.
  • Latency can be checked after connection to the in-game server is established.
    In-game server connection means OnSessionJoinInServer event has been called successfully.

Example

Return as long type

// Current latency
Backend.Match.Latency().NowLatency;
// Maximum latency
Backend.Match.Latency().MaxLatency;
// Minimum latency
Backend.Match.Latency().MinLatency;
// Average latency
Backend.Match.Latency().AvgLatency;

// example
var latancy = Backend.Match.Latency().AvgLatency;
Debug.Log(latancy);

/// <ouput>
/// Data displayed in the Unity console
/// </output>
7

Return as string type

ms is added behind the time.

// Minimum/Average/Maximum latency
Backend.Match.Latency().ToString();
// Current latency
Backend.Match.Latency().ToString("now");
// Maximum latency
Backend.Match.Latency().ToString("max");
// Minimum latency
Backend.Match.Latency().ToString("min");
// Average latency
Backend.Match.Latency().ToString("avg");

// example
var str = Backend.Match.Latency().ToString();
Debug.Log(str);

str = Backend.Match.Latency().ToString("now");
Debug.Log(str);

/// <ouput>
/// Data displayed in the Unity console
/// </output>
RTT Min/Avg/Max: 7/8/8 ms
7 ms

Return cases

Measure latency after a successful connection to the in-game server
see the above example

Measure latency after connecting to the matching server only or before connecting to the in-game server
Minimum latency may be displayed as Long.MaxValue(9223372036854775807).