Skip to content

Commit

Permalink
Only create Flow Subsystem instance if there is no override implement…
Browse files Browse the repository at this point in the history
…ation defined
  • Loading branch information
MothDoctor committed Jan 28, 2022
1 parent ca6b535 commit b0b4736
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/Flow/Private/FlowSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@ UFlowSubsystem::UFlowSubsystem()

bool UFlowSubsystem::ShouldCreateSubsystem(UObject* Outer) const
{
// Only create an instance if there is no override implementation defined elsewhere
TArray<UClass*> ChildClasses;
GetDerivedClasses(GetClass(), ChildClasses, false);
if (ChildClasses.Num() > 0)
{
return false;
}

// in this case, we simply create subsystem for every instance of the game
if (UFlowSettings::Get()->bCreateFlowSubsystemOnClients)
{
return true;
}

return Outer->GetWorld()->GetNetMode() < NM_Client && Outer->GetWorld()->IsServer();
return Outer->GetWorld()->GetNetMode() < NM_Client;
}

void UFlowSubsystem::Initialize(FSubsystemCollectionBase& Collection)
Expand Down

0 comments on commit b0b4736

Please sign in to comment.