Skip to content
This repository was archived by the owner on May 26, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/Runtime/Private/ExtendableGameStateBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ void AExtendableGameStateBase::BeginPlay()
{
Super::BeginPlay();

for(UGameStateSubsystem* Subsystem : GetSubsystemArray<UGameStateSubsystem>())
SubsystemCollection.ForEachSubsystem([this](UGameStateSubsystem* Subsystem)
{
AddReplicatedSubObject(Subsystem);
Subsystem->BeginPlay();
}
}, UGameStateSubsystem::StaticClass());
}

void AExtendableGameStateBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
for(UGameStateSubsystem* Subsystem : GetSubsystemArray<UGameStateSubsystem>())
SubsystemCollection.ForEachSubsystem([this](UGameStateSubsystem* Subsystem)
{
RemoveReplicatedSubObject(Subsystem);
}
}, UGameStateSubsystem::StaticClass());

SubsystemCollection.Deinitialize();

Expand Down
11 changes: 0 additions & 11 deletions Source/Runtime/Public/ExtendableGameStateBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ class GAMESTATESUBSYSTEM_API AExtendableGameStateBase : public AGameStateBase
return nullptr;
}

/**
* Get all Subsystem of specified type, this is only necessary for interfaces that can have multiple implementations instanced at a time.
*
* Do not hold onto this Array reference unless you are sure the lifetime is less than that of AExtendableGameStateBase
*/
template <typename TSubsystemClass>
const TArray<TSubsystemClass*>& GetSubsystemArray() const
{
return SubsystemCollection.GetSubsystemArray<TSubsystemClass>(TSubsystemClass::StaticClass());
}

private:

FObjectSubsystemCollection<UGameStateSubsystem> SubsystemCollection;
Expand Down