So I specify PIE specifically because I am trying to test in the editor and I have set up my Editor Builds to Trigger the Session’s RegisterServer Function which Creates the Dedicated Server’s session. In Debug Mode I step through the code and all is successful. However when I go to Find Sessions I get no results. I am using the OnlineSubsystemNull currently as my default Subsystem.
My current Session Creation in my GameSession class looks like this:
void AMyGameSession::RegisterServer()
{
IOnlineSubsystem * onlineSub = IOnlineSubsystem::Get();
if (onlineSub != nullptr)
{
IOnlineSessionPtr sessionInt = Online::GetSessionInterface();
AMyGameModeBase * gameMode = Cast<AMyGameModeBase>(this->GetWorld()->GetAuthGameMode());
if (sessionInt.IsValid())
{
TSharedPtr<class FMyOnlineSessionSettings> gameHostSettings = MakeShareable(new FMyOnlineSessionSettings(true, false, 4));
gameHostSettings->Set(SETTING_GAMEMODE, FString(*gameMode->GetName()), EOnlineDataAdvertisementType::ViaOnlineService);
gameHostSettings->Set(SETTING_MAPNAME, GetWorld()->GetMapName(), EOnlineDataAdvertisementType::ViaOnlineService);
gameHostSettings->Set(SETTING_MATCHING_HOPPER, FString("MyWorldGame"), EOnlineDataAdvertisementType::DontAdvertise);
gameHostSettings->Set(SETTING_MATCHING_TIMEOUT, 120.0f, EOnlineDataAdvertisementType::ViaOnlineService);
gameHostSettings->Set(SETTING_SESSION_TEMPLATE_NAME, FString("MyWorldGame"), EOnlineDataAdvertisementType::DontAdvertise);
gameHostSettings->bUsesPresence = false;
gameHostSettings->bIsLANMatch = true;
gameHostSettings->bAllowInvites = true;
gameHostSettings->bIsDedicated = true;
gameHostSettings->bShouldAdvertise = true;
gameHostSettings->bAllowJoinInProgress = true;
gameHostSettings->bAllowJoinViaPresence = false;
gameHostSettings->bAllowJoinViaPresenceFriendsOnly = false;
this->hostSettings = gameHostSettings;
this->OnCreateSessionCompleteDelegateHandle = sessionInt->AddOnCreateSessionCompleteDelegate_Handle(this->OnCreateSessionCompleteDelegate);
sessionInt->CreateSession(0, NAME_GameSession, *this->hostSettings);
}
}
}
My Find Session function in my GameInstance looks like this:
void UMyGameInstance::FindSessions(TSharedPtr<const FUniqueNetId> userId, FName sessionName, bool bIsLan, bool bIsPresence)
{
IOnlineSubsystem * onlineSub = IOnlineSubsystem::Get();
if(onlineSub != nullptr)
{
IOnlineSessionPtr sessions = onlineSub->GetSessionInterface();
if (sessions.IsValid())
{
const FString gameMatch("MyGameWorld");
this->SessionSearch = MakeShareable(new FMyOnlineSearchSettings(bIsLan, bIsPresence));
this->SessionSearch->bIsLanQuery = bIsLan;
this->SessionSearch->MaxSearchResults = 20;
this->SessionSearch->PingBucketSize = 50;
//this->SessionSearch->QuerySettings.Set(SEARCH_KEYWORDS, gameMatch, EOnlineComparisonOp::Equals);
TSharedRef<FOnlineSessionSearch> searchSettingsRef = this->SessionSearch.ToSharedRef();
this->OnFindSessionsCompleteDelegateHandle = sessions->AddOnFindSessionsCompleteDelegate_Handle(this->OnFindSessionsCompleteDelegate);
sessions->FindSessions(*userId, searchSettingsRef);
}
}
else
{
this->OnFindSessionsComplete(false);
}
}