Client notification by UMG on server disconnection

At the moment I am involved in creating a multiplayer networked game and when the server disconnects, the clients simply get booted to the default map (the main menu in my case). What I’m trying to do is bring up a UMG widget that notifies the user that there has been a network error and only takes it to the menu after they have clicked the ok button or pressed a key. I’ve tried using the Event NetworkError in the Game Instance but it doesn’t seem to even print anything from the failure type when I put a print string node there. Does anyone have any idea how I could achieve this in Blueprints or C++?

Does anyone have any idea about this? Any ue4 dev or community member?

Override GameInstance::HandleNetworkFailure

virtual void HandleNetworkFailure(UWorld *World, UNetDriver *NetDriver, ENetworkFailure::Type FailureType, const FString& ErrorString);

So several months later I’ve gone back to attempt this again. I tried Li’s answer but that didn’t work for me, I also couldn’t find that function in the game instance to override even though the code compiled fine and there was no error.

I attempted once again to use the Event Network Error in the Game Instance Blueprint and for some reason now it worked. I had to add a “Do Once” node because the Network Error would be spammed (from testing with a Print String) but other than that it worked fine, I used the ‘failure type’ for a switch and then created my ui and added it to the viewport and it allowed me to focus a button with the controller which i use for user input to go back to the main menu. I would’ve liked to achieve this in code but the blueprints work for me so I am leaving it at that for now.

How do you override it? :blush: