ConnectionIsValid
Namespace: SynicSugar.P2P
Class: p2pInfo
public bool ConnectionIsValid ()
Description
Checks if the connection has been enabled by the library or user.
This does not necessarily mean that an actual connection has been established.
The IsConnected flag becomes true after the user or library initiates the connection.
After that, it will never become False unless we explicitly Pause connection.
using SynicSugar.P2P;
using UnityEngine;
[NetworkCommons]
public partial class p2pSample : MonoBehaviour {
public void RestartConnection(){
if(p2pInfo.Instance.ConnectionIsValid()){
return;
}
ConnectHub.Instance.RestartConnections();
}
}