Hello! I’m using Unreal Engine 5.3.2 and I’m learning the “Online Services EOS” and “Online Services EOS (Game Service)” Plugins. The problem that I’m having is that my game is crashing when I try to get the connect string.
I’m bein able to login with epic account and create new sessions successfuly, I can also found the sessions on the dev portal. Then with a second client I can find the session and join it successfully but when I try to get the connect string the game crashes.
After I find a session I call this function to join it:
void UEOSGameInstance::ProcessJoinSession(UE::Online::FOnlineSessionId& SessionId)
{
using namespace UE::Online;
IOnlineServicesPtr OnlineServices = GetServices();
ISessionsPtr SessionsInterface = OnlineServices->GetSessionsInterface();
FJoinSession::Params Params;
Params.LocalAccountId = GetLocalUserId();
Params.SessionId = SessionId;
Params.SessionName = NAME_GameSession;
SessionsInterface->JoinSession(MoveTemp(Params)).OnComplete(
[Params,this]
(const TOnlineResult<FJoinSession>& Result)
{
if (Result.IsOk())
{
GEngine->AddOnScreenDebugMessage(-1, 3, FColor::Green, TEXT("Successfuly joined a session!"));
FSessionJoined SessionJoined;
SessionJoined.LocalAccountId = Params.LocalAccountId;
SessionJoined.SessionId = Params.SessionId;
OnSessionJoinedHandle(SessionJoined);
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Red, TEXT("Fail on join session!"));
}
}
);
}
OnSessionJoinHandle process the client travel getting the connect string using this function, and when OnlineServices->GetResolvedConnectString gets called the game crashes…
FString UEOSGameInstance::GetConnectString(const UE::Online::FSessionJoined& SessionJoined_)
{
using namespace UE::Online;
IOnlineServicesPtr OnlineServices = GetServices();
FGetResolvedConnectString::Params Params_;
Params_.SessionId = SessionJoined_.SessionId;
Params_.LocalAccountId = SessionJoined_.LocalAccountId;
Params_.PortType = NAME_GamePort;
//Crashing here
const TOnlineResult<FGetResolvedConnectString>& GetConnStrRes =
OnlineServices->GetResolvedConnectString(MoveTemp(Params_));
if (GetConnStrRes.IsOk())
{
FString ConnectString = GetConnStrRes.GetOkValue().ResolvedConnectString;
GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Green,
FString::Printf(TEXT("%s"),*ConnectString));
return ConnectString;
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Red, TEXT("Fail on get the connect string!"));
}
return FString();
}
I added those lines on DefaultEngine.ini…
[OnlineServices]
DefaultServices=Epic
bUseBuildIdOverride=false
BuildIdOverride=0
[/Script/Engine.Engine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="SocketSubsystemEOS.NetDriverEOSBase",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="DemoNetDriver",DriverClassName="/Script/Engine.DemoNetDriver",DriverClassNameFallback="/Script/Engine.DemoNetDriver")
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="SocketSubsystemEOS.NetDriverEOSBase",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="DemoNetDriver",DriverClassName="/Script/Engine.DemoNetDriver",DriverClassNameFallback="/Script/Engine.DemoNetDriver")
[OnlineServices.EOS]
ProductId=...
SandboxId=...
DeploymentId=...
ClientId=...
ClientSecret=...
ClientEncryptionKey=...
When the gmae crashes it gives this line as information:
Assertion failed: EOS_ProductUserId_IsValid(ProductUserId) == 1 [File:D:\build++UE5\Sync\Engine\Plugins\Online\OnlineServicesEOSGS\Source\Private\Online\OnlineIdEOSGS.cpp] [Line: 114]
After making some tests I found out that GetResolvedConnect string works fine on the client that has created the session, and on the client that is trying to connect the problem seems that ISession::GetOwnerAccountId().IsValid() is returning false…
If someone could help me with this problem I will be grateful.