Unity crashing when calling on StopHost or DropConnection

Helly everybody,

I’m trying to make my player disconnect from a match. It’s a 1v1 match and if the player disconnect I want to close the connection.

When a player disconnects:
[server side] Works great, the player disconnects and returns to the lobby. [client side] Unity Editor Crashes or my application collapses (stop responding).

I’m trying to do the following on the client:

` if (networkIdentity.isClient)
{

        MatchInfo currentMatch = networkManager.matchInfo;

        networkManager.matchMaker.DropConnection(currentMatch.networkId, currentMatch.nodeId, 0, networkManager.OnDropConnection);

        networkManager.StopHost();

    }`

Am I missing something?

Hey guys in case someone ends up here…

I figured out the problem I had a StopHost() being called on the wrong callback (OnClientStop in my case).

The important takeaway here is to use the Unity Log Files(check where it is here Unity - Manual: Log Files) to understand whats going on under the hood on your game. This is how I got out of this situation.

Cheers.