private void InitializeSingleton() { if (!(singleton != null) || !(singleton == this)) { if (dontDestroyOnLoad) { if (singleton != null) { QLog.Warning("Multiple NetworkManagers detected in the scene. Only one NetworkManager can exist at a time. The duplicate NetworkManager will not be used."); Destroy(gameObject); return; } QLog.Log("NetworkManager created singleton (DontDestroyOnLoad)"); singleton = this; if (Application.isPlaying) { DontDestroyOnLoad(gameObject); } } else { QLog.Log("NetworkManager created singleton (ForScene)"); singleton = this; } if (networkAddress != "") { s_Address = networkAddress; } else if (s_Address != "") { networkAddress = s_Address; } } }
public static void Shutdown() { if (!(singleton == null)) { s_ClientReadyConnection = null; singleton.StopHost(); singleton = null; } }
private void Awake() => Manager = GetComponent <QNetworkManager>();