(SharedMode) DisconnectException
Hello, I'm a new Fusion user, coming from years of using PUN2, using SharedMode.
The scenario I'm trying to understand is when the player hits a connect button, and cancels the connection attempt *before it succeeds/fails.* So in PUN, I was able to Disconnect while waiting for the OnConnectedToMaster callback, which would cancel the connection attempt. In Fusion SharedMode I think the equivalent of PhotonNetwork.Disconnect() is Runner.Shutdown().
So the following code is working for my use case (adapted from BasicSpawner in the Fusion 101 tutorial), but I get 3 exceptions:
[Fusion] Fusion.Photon.Realtime.Async.DisconnectException
DisconnectException: DisconnectByClientLogic
[Fusion] Failed Operation with Reason: Ok
If this is the wrong approach, should use some kind of Task cancellation?
If this is a good approach, can I suppress/catch these errors somehow? Or are they utterly harmless?
private NetworkRunner _runner; public async void StartGame(GameMode mode) { if (_runner == null) _runner = gameObject.AddComponent<NetworkRunner>(); _runner.ProvideInput = true; await _runner.StartGame(new StartGameArgs() { GameMode = mode, SessionName = "TestRoom", SceneManager = gameObject.AddComponent<NetworkSceneManagerDefault>() }); } public void ForceShutdown() { _runner.Shutdown(false); }
Comments
-
Off topic: The formatting options are on the left hand side of the input. The quotation-marks icon "hides" options to format selected text as code or quotes.
0 -
Hi,
did you find a soltion for this? I have the same problem.
Thanks,
0