private void OnDeviceRemoved(object sender, System.EventArgs e) { DeviceInterface.StatusUpdate -= OnStatusUpdate; DeviceInterface.DeviceRemoved -= OnDeviceRemoved; Disconneted?.Invoke(this, null); }
IEnumerator CheckConnect() { yield return(new WaitForSeconds(10f)); if (ServerConnection == null) { Disconneted?.Invoke(); SceneManager.sceneLoaded -= SceneManager_sceneLoaded; SceneManager.LoadSceneAsync("Main", LoadSceneMode.Single); } else { StartCoroutine("CheckConnect"); } }
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { if (arg0.name == map) { mapCam = GameObject.Find("Map Camera").transform; parentForObj = GameObject.Find("InstansesEmpty").transform; mpPrefs = mapCam.GetComponent <MapPrefs>(); ConnectToServer(); } else { Debug.LogWarning("WRONG MAP!"); Disconneted?.Invoke(); SceneManager.sceneLoaded -= SceneManager_sceneLoaded; SceneManager.LoadSceneAsync("Main", LoadSceneMode.Single); } }