Skip to content

Commit

Permalink
feat: load subsystems from settings
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Oct 10, 2024
1 parent 50f89f9 commit 4de7b39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
18 changes: 3 additions & 15 deletions Source/Ecsact/Public/EcsactUnreal/EcsactRunner.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "EcsactUnreal/EcsactRunner.h"
#include "EcsactUnreal/EcsactAsyncRunnerEvents.h"
#include "EcsactUnreal/EcsactSettings.h"
#include "EcsactUnreal/EcsactUnrealExecutionOptions.h"
#include "Engine/Engine.h"
#include "Engine/World.h"
Expand Down Expand Up @@ -101,25 +102,12 @@ auto UEcsactRunner::GeneratePlaceholderId() -> ecsact_placeholder_entity_id {
}

auto UEcsactRunner::InitRunnerSubsystems() -> void {
auto subsystem_types = TArray<UClass*>{};
for(auto it = TObjectIterator<UClass>{}; it; ++it) {
auto uclass = *it;

if(!uclass->IsChildOf(UEcsactRunnerSubsystem::StaticClass())) {
continue;
}

if(uclass->HasAnyClassFlags(CLASS_Abstract)) {
continue;
}

subsystem_types.Add(uclass);
}
const auto* settings = GetDefault<UEcsactSettings>();

check(RunnerSubsystems.IsEmpty());
RunnerSubsystems.Empty();

for(auto t : subsystem_types) {
for(auto t : settings->RunnerSubsystems) {
UE_LOG(Ecsact, Log, TEXT("Starting ecsact subsystem %s"), *t->GetName());
auto subsystem = NewObject<UEcsactRunnerSubsystem>(this, t);
subsystem->OwningRunner = this;
Expand Down
2 changes: 1 addition & 1 deletion Source/Ecsact/Public/EcsactUnreal/EcsactSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ class ECSACT_API UEcsactSettings : public UObject {
)
TSubclassOf<UEcsactRunner> CustomRunnerClass;

UPROPERTY(VisibleAnywhere, Config, Category = "Runtime")
UPROPERTY(EditAnywhere, Config, Category = "Runtime")
TArray<TSubclassOf<class UEcsactRunnerSubsystem>> RunnerSubsystems;
};

0 comments on commit 4de7b39

Please sign in to comment.