From e45cb4762e6f3b1616114e40038d59d4a0cbc9c5 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Fri, 16 Aug 2024 09:15:10 -0700 Subject: [PATCH] fix: avoid ticking on default object --- Source/Ecsact/Private/Ecsact.cpp | 35 +++++++++++----------- Source/Ecsact/Public/EcsactAsyncRunner.cpp | 1 - Source/Ecsact/Public/EcsactRunner.cpp | 4 +++ Source/Ecsact/Public/EcsactRunner.h | 1 + Source/Ecsact/Public/EcsactSyncRunner.cpp | 1 - 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Source/Ecsact/Private/Ecsact.cpp b/Source/Ecsact/Private/Ecsact.cpp index 5b8d6a1..298b6f1 100644 --- a/Source/Ecsact/Private/Ecsact.cpp +++ b/Source/Ecsact/Private/Ecsact.cpp @@ -123,24 +123,23 @@ auto FEcsactModule::StartRunner() -> void { StopRunner(); } - // switch(settings->Runner) { - // case EEcsactRuntimeRunnerType::Automatic: - // if(ecsact_async_flush_events == nullptr) { - // Runner = NewObject(); - // } else { - // Runner = NewObject(); - // } - // break; - // case EEcsactRuntimeRunnerType::Asynchronous: - // Runner = NewObject(); - // break; - // case EEcsactRuntimeRunnerType::Custom: - // if(settings->CustomRunnerClass != nullptr) { - // Runner = NewObject(nullptr, - // settings->CustomRunnerClass); - // } - // break; - // } + switch(settings->Runner) { + case EEcsactRuntimeRunnerType::Automatic: + if(ecsact_async_flush_events == nullptr) { + Runner = NewObject(); + } else { + Runner = NewObject(); + } + break; + case EEcsactRuntimeRunnerType::Asynchronous: + Runner = NewObject(); + break; + case EEcsactRuntimeRunnerType::Custom: + if(settings->CustomRunnerClass != nullptr) { + Runner = NewObject(nullptr, settings->CustomRunnerClass); + } + break; + } if(Runner != nullptr) { UE_LOG( diff --git a/Source/Ecsact/Public/EcsactAsyncRunner.cpp b/Source/Ecsact/Public/EcsactAsyncRunner.cpp index 450a8a2..fc9f566 100644 --- a/Source/Ecsact/Public/EcsactAsyncRunner.cpp +++ b/Source/Ecsact/Public/EcsactAsyncRunner.cpp @@ -5,7 +5,6 @@ #include "ecsact/runtime/common.h" auto UEcsactAsyncRunner::Tick(float DeltaTime) -> void { - UE_LOG(Ecsact, Log, TEXT("ASYNC RUNNER TICK()")); if(ecsact_async_flush_events == nullptr) { UE_LOG(Ecsact, Error, TEXT("ecsact_async_flush_events is unavailable")); } else { diff --git a/Source/Ecsact/Public/EcsactRunner.cpp b/Source/Ecsact/Public/EcsactRunner.cpp index 227f987..b7bc027 100644 --- a/Source/Ecsact/Public/EcsactRunner.cpp +++ b/Source/Ecsact/Public/EcsactRunner.cpp @@ -6,3 +6,7 @@ auto UEcsactRunner::Tick(float DeltaTime) -> void { auto UEcsactRunner::GetStatId() const -> TStatId { RETURN_QUICK_DECLARE_CYCLE_STAT(UEcsactRunner, STATGROUP_Tickables); } + +auto UEcsactRunner::IsTickable() const -> bool { + return !IsTemplate(); +} diff --git a/Source/Ecsact/Public/EcsactRunner.h b/Source/Ecsact/Public/EcsactRunner.h index e3c37bf..b1eea89 100644 --- a/Source/Ecsact/Public/EcsactRunner.h +++ b/Source/Ecsact/Public/EcsactRunner.h @@ -12,4 +12,5 @@ class UEcsactRunner : public UObject, public FTickableGameObject { public: auto Tick(float DeltaTime) -> void override; auto GetStatId() const -> TStatId override; + auto IsTickable() const -> bool override; }; diff --git a/Source/Ecsact/Public/EcsactSyncRunner.cpp b/Source/Ecsact/Public/EcsactSyncRunner.cpp index ed5d9c3..a8f3878 100644 --- a/Source/Ecsact/Public/EcsactSyncRunner.cpp +++ b/Source/Ecsact/Public/EcsactSyncRunner.cpp @@ -4,7 +4,6 @@ #include "ecsact/runtime/core.h" auto UEcsactSyncRunner::Tick(float DeltaTime) -> void { - UE_LOG(Ecsact, Log, TEXT("SYNC RUNNER TICK()")); if(ecsact_execute_systems == nullptr) { UE_LOG(Ecsact, Error, TEXT("ecsact_execute_systems is unavailable")); return;