DruidMech / MultiplayerCourseMenuSystem

A system for connecting players across Steam
183 stars 66 forks source link

UE 5.1 : OnLevelRemovedFromWorld is no longer part of UUSerWidget #1

Open bobgames opened 1 year ago

bobgames commented 1 year ago

Hi,

i propose to make a new branch for 5.1 and upward until there is an official statement about this from unreal. I'm kinda new but i hope this could be of some help.

The differences between the 2 versions should be :

Menu.h : l.24 : virtual void OnLevelRemovedFromWorld(ULevel InLevel, UWorld InWorld) override; into virtual void OnLevelRemovedFromWorld(ULevel InLevel, UWorld InWorld);

Menu.cpp l.71 : Super::OnLevelRemovedFromWorld(InLevel, InWorld); into Super::NativeDestruct();

Best regards.

gregor-dietrich commented 1 year ago

OnLevelRemovedFromWorld can't be overriden because it doesn't exist in 5.1 anymore, so your suggestion is only half-right. The method body in your Cpp file is correct, but this OnLevelRemovedFromWorld will never get called.

Rather than doing this, you should remove OnLevelRemovedFromWorld() entirely from both the Header- and Cpp-File and instead override the protected virtual void method NativeDestruct() like so: https://github.com/gregor-dietrich/MultiplayerCourseMenuSystem/commit/f7e7f1671c560ae4fb2de6d41ebdf32ce50ecd0b

Best Regards

DEDE-Game commented 1 year ago

Hi,Best wishet eveyone; I ve tryed many methord to fix this problem,but i found it does't called either(the "No override' one and the "NativeDestruct()" One),and i make the function MenuTearDown to a BlueprintCallable and when i clicked the button i call it inside the Blueprint,So ,nearly fixed HHHaaa,but it's just a recently solution,if there any Master can help with this issue?Best wishes///