I need to setup LAN = true / false, Name and Slots of servers on start;
Should i use cin?
// Fill out your copyright notice in the Description page of Project Settings.
#include "DedicatedGameSession.h"
#include "OnlineSubsystem.h"
#include "OnlineSessionInterface.h"
#include "OnlineSessionSettings.h"
void ADedicatedGameSession::RegisterServer()
{
Super::RegisterServer();
UE_LOG(LogTemp, Log, TEXT("----Start Creating Server----"));
IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get();
if (OnlineSubsystem == nullptr)
{
UE_LOG(LogTemp, Error, TEXT("----Can't find subsystem----"));
return;
}
UE_LOG(LogTemp, Log, TEXT("----Getting Subsystem----"));
IOnlineSessionPtr Session = OnlineSubsystem->GetSessionInterface();
UE_LOG(LogTemp, Log, TEXT("----Getting Session Interface----"));
FOnlineSessionSettings Settings;
Settings.bIsDedicated = true;
Settings.bIsLANMatch = true;
Settings.bAllowJoinInProgress = true;
Settings.bShouldAdvertise = true;
Settings.NumPublicConnections = 100;
Settings.bUsesPresence = true;
UE_LOG(LogTemp, Log, TEXT("----Creating Settings----"));
Session->CreateSession(0,GameSessionName,Settings);
UE_LOG(LogTemp,Log,TEXT("----Session Created----"));
}