From 4de7b3976467e9689abac890fdbbf07166d0def6 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Thu, 10 Oct 2024 14:30:59 -0700 Subject: [PATCH] feat: load subsystems from settings --- .../Public/EcsactUnreal/EcsactRunner.cpp | 18 +++--------------- .../Public/EcsactUnreal/EcsactSettings.h | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.cpp b/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.cpp index 127489b..3aac196 100644 --- a/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.cpp +++ b/Source/Ecsact/Public/EcsactUnreal/EcsactRunner.cpp @@ -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" @@ -101,25 +102,12 @@ auto UEcsactRunner::GeneratePlaceholderId() -> ecsact_placeholder_entity_id { } auto UEcsactRunner::InitRunnerSubsystems() -> void { - auto subsystem_types = TArray{}; - for(auto it = TObjectIterator{}; 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(); 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(this, t); subsystem->OwningRunner = this; diff --git a/Source/Ecsact/Public/EcsactUnreal/EcsactSettings.h b/Source/Ecsact/Public/EcsactUnreal/EcsactSettings.h index ad2a200..c72bb27 100644 --- a/Source/Ecsact/Public/EcsactUnreal/EcsactSettings.h +++ b/Source/Ecsact/Public/EcsactUnreal/EcsactSettings.h @@ -93,6 +93,6 @@ class ECSACT_API UEcsactSettings : public UObject { ) TSubclassOf CustomRunnerClass; - UPROPERTY(VisibleAnywhere, Config, Category = "Runtime") + UPROPERTY(EditAnywhere, Config, Category = "Runtime") TArray> RunnerSubsystems; };