Any disconnection event?

Hello,

how can I detect that the server has been closed or the connection has been lost on my client? I cant find anything obvious and I want to show a message when the host of the server leaves the game.

Thanks in advance

There are couple of ways you can approach this. For the start, you can define Network Failure method in your game instance.

Then in your GameInstance::Init(), use this: GetEngine()->OnNetworkFailure().AddUObject(this, &YourGameInstance::HandleNetworkFailure);

But, there is catch. If there is a server created, and you start joining, and server declines your join request for some reason. Your game will reset. If you want to prevent this, the way I did it is to override game engine (which is a procedure for itself). Override function HandleNetworkFailure and then handle failure by yourself.

1 Like

Thanks, this was the event I was looking for, works like a charme!

image

trying to load an alternative ‘network error map’ but is not working.

replacing open level by quit event it actually quits the game so the open level is reached but overriden.