Hi, I’ve been having an issue with finding sessions in Unreal 5.5/5.6. In a packaged build when testing multiplayer through 2 different Steam accounts on 2 different computers, I always get a fatal error when I attempt to Find Sessions. I’ve tried a bunch of different combinations of settings and I simply cannot get it to work.
My session create code looks like this:
FOnlineSessionSettings Settings;
Settings.bAllowJoinInProgress = true;
Settings.bIsDedicated = false;
Settings.bShouldAdvertise = true;
Settings.bUsesPresence = true;
Settings.NumPublicConnections = 5;
Settings.bUseLobbiesIfAvailable = true;
SessionInterface->CreateSession(0, NAME_GameSession, Settings);
And my find sessions code looks like this:
SessionSearch = MakeShared<FOnlineSessionSearch>();
SessionSearch->bIsLanQuery = false;
SessionSearch->MaxSearchResults = 10000;
SessionSearch->QuerySettings.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
SessionInterface->FindSessions(0, SessionSearch.ToSharedRef());
DefaultEngine.ini:
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=True
SteamDevAppId=[My id]
bInitServerOnClient=true
SteamAppId=[My id]
[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName=OnlineSubsystemSteam.SteamNetConnection
Build.cs file:
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[]
{
"Core",
"CoreOnline",
"CoreUObject",
"GameplayAbilities",
"GameplayTags",
"GameplayTasks",
"Engine",
"EnhancedInput",
"InputCore",
"Networking",
"OnlineSubsystem",
"OnlineSubsystemUtils",
"Paper2D",
"UMG"
});
PrivateDependencyModuleNames.AddRange(new string[]
{
"EnhancedInput",
"OnlineSubsystemSteam"
});
If I remove the line SessionSearch->QuerySettings.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
it won’t crash with a fatal error anymore but I also won’t find any sessions at all. There also seems to be no difference whether I use SEARCH_LOBBIES
or SEARCH_PRESENCE
, it will crash just in the same way.
I also tried both the SteamSockets net driver and the default Steam Net Driver, same issue. Another thing I noticed while debugging is that if I don’t bind anything to the OnFindSessionsCompleteDelegates
, it also won’t crash so I thought it could perhaps be a object lifetime issue or similar, but the problem is that it crashes way before it even attampts to broadcast the delegate, so I’m a bit dumbfounded as to what the issue might be.
I would be thankful if anyone can help me solve this issue, as I’ve been stuck on it quite some time.