Photon Unity Networking 2 2.45

Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SystemConnectionSummary Class Reference

The SystemConnectionSummary (SBS) is useful to analyze low level connection issues in Unity. This requires a ConnectionHandler in the scene. More...

Public Member Functions

 SystemConnectionSummary (LoadBalancingClient client)
 Creates a SystemConnectionSummary for an incident of a local LoadBalancingClient. This gets used automatically by the LoadBalancingClient! More...
 
 SystemConnectionSummary (int summary)
 Creates a SystemConnectionSummary instance from an int (reversing ToInt()). This can then be turned into a string again. More...
 
int ToInt ()
 Turns the SystemConnectionSummary into an integer, which can be be used for analytics purposes. It contains a lot of info and can be used to instantiate a new SystemConnectionSummary. More...
 
override string ToString ()
 A readable debug log string of the context for network problems. More...
 

Static Public Member Functions

static bool GetBit (ref int value, int bitpos)
 
static byte GetBits (ref int value, int bitpos, byte mask)
 
static void SetBit (ref int value, bool bitval, int bitpos)
 Applies bitval to bitpos (no matter value's initial bit value). More...
 
static void SetBits (ref int value, byte bitvals, int bitpos)
 Applies bitvals via OR operation (expects bits in value to be 0 initially). More...
 

Public Attributes

readonly byte Version = 0
 
byte UsedProtocol
 
bool AppQuits
 
bool AppPause
 
bool AppPauseRecent
 
bool AppOutOfFocus
 
bool AppOutOfFocusRecent
 
bool NetworkReachable
 
bool ErrorCodeFits
 
bool ErrorCodeWinSock
 
int SocketErrorCode
 

Detailed Description

The SystemConnectionSummary (SBS) is useful to analyze low level connection issues in Unity. This requires a ConnectionHandler in the scene.

A LoadBalancingClient automatically creates a SystemConnectionSummary on these disconnect causes: DisconnectCause.ExceptionOnConnect, DisconnectCause.Exception, DisconnectCause.ServerTimeout and DisconnectCause.ClientTimeout.

The SBS can then be turned into an integer (ToInt()) or string to debug the situation or use in analytics. Both, ToString and ToInt summarize the network-relevant conditions of the client at and before the connection fail, including the PhotonPeer.SocketErrorCode.

Important: To correctly create the SBS instance, a ConnectionHandler component must be present and enabled in the Unity scene hierarchy. In best case, keep the ConnectionHandler on a GameObject which is flagged as DontDestroyOnLoad.

Constructor & Destructor Documentation

◆ SystemConnectionSummary() [1/2]

Creates a SystemConnectionSummary for an incident of a local LoadBalancingClient. This gets used automatically by the LoadBalancingClient!

If the LoadBalancingClient.SystemConnectionSummary is non-null after a connection-loss, you can call .ToInt() and send this to analytics or log it.

Parameters
client

◆ SystemConnectionSummary() [2/2]

SystemConnectionSummary ( int  summary)

Creates a SystemConnectionSummary instance from an int (reversing ToInt()). This can then be turned into a string again.

Parameters
summaryAn int, as provided by ToInt(). No error checks yet.

Member Function Documentation

◆ SetBit()

static void SetBit ( ref int  value,
bool  bitval,
int  bitpos 
)
static

Applies bitval to bitpos (no matter value's initial bit value).

◆ SetBits()

static void SetBits ( ref int  value,
byte  bitvals,
int  bitpos 
)
static

Applies bitvals via OR operation (expects bits in value to be 0 initially).

◆ ToInt()

int ToInt ( )

Turns the SystemConnectionSummary into an integer, which can be be used for analytics purposes. It contains a lot of info and can be used to instantiate a new SystemConnectionSummary.

Returns
Compact representation of the context for a disconnect issue.

◆ ToString()

override string ToString ( )

A readable debug log string of the context for network problems.

Returns
SystemConnectionSummary as readable string.