Skip to content

Commit 40f4d3f

Browse files
committed
Added cmd argument: -checkinst=<0/1|true/false> it's useful for testing multiplayer game on a single pc
1 parent 8aa1329 commit 40f4d3f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Source/CheckAppInstance/Private/CheckAppInstanceBPLibrary.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ UCheckAppInstanceBPLibrary::UCheckAppInstanceBPLibrary(const FObjectInitializer&
1212
void UCheckAppInstanceBPLibrary::CheckAnotherAppInstance(bool bIsEnabled)
1313
{
1414
#if !UE_EDITOR
15+
FString ParseValue;
16+
if (FParse::Value(FCommandLine::Get(), TEXT("-checkinst="), ParseValue))
17+
{
18+
bIsEnabled = ParseValue.ToBool();
19+
}
20+
1521
FCoreDelegates::OnAllModuleLoadingPhasesComplete.AddLambda([bIsEnabled]()
1622
{
1723
// Only one instance of the game can be initialized!

Source/CheckAppInstance/Public/CheckAppInstanceBPLibrary.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "HAL/PlatformApplicationMisc.h"
88
#include "GeneralProjectSettings.h"
99
#include "Misc/CoreDelegates.h"
10+
#include "Misc/CommandLine.h"
1011
#include "CheckAppInstanceBPLibrary.generated.h"
1112

1213
UCLASS()

0 commit comments

Comments
 (0)