Tips for anyone that Used OnLevelRemovedFromWorld. Another way to Leave Server

I noticed multiple people in the Q&A on Udemy with this problem. You can call your tear down logic in the NativeDestruct() method. Also The function that you’re binding to your cancel buttons OnClick event call RemoveFromParent(); this method destroys the widget and NativeDestruct() is called. Also Instead of Using ClientTravel() you can use UGameInstance::ReturnToMainMenu() this function handles diconnecting you from the current server and Loading the Default Map.

Something like this for Setting up and Tearing Down your widgets. NativeDestruct() will also be called when Leaving MainMenu Level. This Works as of Engine Version 5.0.1. (github.com)

UGameInstance::ReturnToMainMenu | Unreal Engine Documentation

2 Likes

Thank you for sharing this.

Privacy & Terms