#[Solved] Game crashes when I click Return To Main Menu Button

25 messages ยท Page 1 of 1 (latest)

inner pike
#

Hi,
In Lecture 11 - Leaving the Game, When I click on ReturnToMainMenu Button game crashes and gives me this error

`Assertion failed: SessionInfo->SessionType == ESteamSession::AdvertisedSessionHost || SessionInfo->SessionType == ESteamSession::AdvertisedSessionClient [File:D:\build++UE5\Sync\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private\OnlineSessionInterfaceSteam.cpp] [Line: 648]

0x00007ffb54dd6d53 UnrealEditor-OnlineSubsystemSteam.dll!UnknownFunction []
0x00007ffb54dd7797 UnrealEditor-OnlineSubsystemSteam.dll!UnknownFunction []
0x00007ffb1c68587a UnrealEditor-MultiplayerSessions-0011.dll!UMultiplayerSessionsSubsystem::DestroySession() [F:\UnrealProjects\Blaster\Plugins\MultiplayerSessions\Source\MultiplayerSessions\Private\MultiplayerSessionsSubsystem.cpp:126]
0x00007ffb73bca8bc UnrealEditor-CoreUObject.dll!UnknownFunction [] ....`

Here is my code in line 126 of MultiplayerSessionSubsystem.cpp:

void UMultiplayerSessionsSubsystem::DestroySession()
{
    if(!IsValidSessionInterface())
    {
        MultiplayerOnDestroySessionComplete.Broadcast(false);
        return;
    }

    DestroySessionCompleteDelegateHandle =
        SessionInterface->AddOnDestroySessionCompleteDelegate_Handle(DestroySessionCompleteDelegate);
    
    if(!SessionInterface->DestroySession(NAME_GameSession,DestroySessionCompleteDelegate))
    {
        SessionInterface->ClearOnDestroySessionCompleteDelegate_Handle(DestroySessionCompleteDelegateHandle);
        MultiplayerOnDestroySessionComplete.Broadcast(false);
    }
} ```

can someone help me?
glad verge
#

Here's my code, you have a couple of differences there, check them out.

void UMultiplayerSessionsSubsystem::DestroySession()
{
    if (!SessionInterface.IsValid())
    {
        MultiplayerOnDestroySessionComplete.Broadcast(false);
        return;
    }

    DestroySessionCompleteDelegateHandle = SessionInterface->AddOnDestroySessionCompleteDelegate_Handle(DestroySessionCompleteDelegate);
    if (!SessionInterface->DestroySession(NAME_GameSession))
    {
        SessionInterface->ClearOnDestroySessionCompleteDelegate_Handle(DestroySessionCompleteDelegateHandle);
        MultiplayerOnDestroySessionComplete.Broadcast(false);
    }
}
#

cool tip, get Winmerge to compare code in 2 seconds

inner pike
inner pike
#

I tried the game in a project build, client can leave the session without any problem, but the above crash happens for host when he leaves the game

glad verge
#

mmm there must be more stuff then

#

copy paste the crash code here

inner pike
# glad verge copy paste the crash code here

It's in the first comment:

Assertion failed: SessionInfo->SessionType == ESteamSession::AdvertisedSessionHost || SessionInfo->SessionType == ESteamSession::AdvertisedSessionClient [File:D:\build\++UE5\Sync\Engine\Plugins\Online\OnlineSubsystemSteam\Source\Private\OnlineSessionInterfaceSteam.cpp] [Line: 648] 0x00007ffb54dd6d53 UnrealEditor-OnlineSubsystemSteam.dll!UnknownFunction [] 0x00007ffb54dd7797 UnrealEditor-OnlineSubsystemSteam.dll!UnknownFunction [] 0x00007ffb1c68587a UnrealEditor-MultiplayerSessions-0011.dll!UMultiplayerSessionsSubsystem::DestroySession() [F:\UnrealProjects\Blaster\Plugins\MultiplayerSessions\Source\MultiplayerSessions\Private\MultiplayerSessionsSubsystem.cpp:126] 0x00007ffb73bca8bc UnrealEditor-CoreUObject.dll!UnknownFunction [] ....

glad verge
#

can you paste me the whole cpp file?

#

it will upload it as a file if you copy/paste the code

inner pike
glad verge
#

there is a ton of differences between my code and your code

#

my code is identical to Stephen's

#

I suggest using Winmerge to codecompare, not to lose your mind

inner pike
glad verge
# inner pike Sure, I'll give it a try, thanks ๐Ÿ™

for the Plugin making, really make sure you follow stephen's code to the letter, cause this part is probably the most difficult part of the course, maybe the only comparable one is LagComp, though this one should really be followed to the letter in order to avoid crashes or simply not being able to connect to the host.

inner pike
glad verge
#

yeah I also made a few mistakes back then and stuff just either wasn't compiling or I was getting crashes, easiest way to go through this part is just to code compare with winmerge.
I used to get Stephen's code and compare it with mine and after that, it was all working properly

inner pike
inner pike
inner pike
#

It works completely fine ๐Ÿ˜

#

Game crashes when I click Return To Main Menu Button [Solved]