Skip to content

Commit

Permalink
fix: avoid ticking on default object
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Aug 16, 2024
1 parent 1e1ed08 commit e45cb47
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
35 changes: 17 additions & 18 deletions Source/Ecsact/Private/Ecsact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,23 @@ auto FEcsactModule::StartRunner() -> void {
StopRunner();
}

// switch(settings->Runner) {
// case EEcsactRuntimeRunnerType::Automatic:
// if(ecsact_async_flush_events == nullptr) {
// Runner = NewObject<UEcsactSyncRunner>();
// } else {
// Runner = NewObject<UEcsactAsyncRunner>();
// }
// break;
// case EEcsactRuntimeRunnerType::Asynchronous:
// Runner = NewObject<UEcsactAsyncRunner>();
// break;
// case EEcsactRuntimeRunnerType::Custom:
// if(settings->CustomRunnerClass != nullptr) {
// Runner = NewObject<UEcsactRunner>(nullptr,
// settings->CustomRunnerClass);
// }
// break;
// }
switch(settings->Runner) {
case EEcsactRuntimeRunnerType::Automatic:
if(ecsact_async_flush_events == nullptr) {
Runner = NewObject<UEcsactSyncRunner>();
} else {
Runner = NewObject<UEcsactAsyncRunner>();
}
break;
case EEcsactRuntimeRunnerType::Asynchronous:
Runner = NewObject<UEcsactAsyncRunner>();
break;
case EEcsactRuntimeRunnerType::Custom:
if(settings->CustomRunnerClass != nullptr) {
Runner = NewObject<UEcsactRunner>(nullptr, settings->CustomRunnerClass);
}
break;
}

if(Runner != nullptr) {
UE_LOG(
Expand Down
1 change: 0 additions & 1 deletion Source/Ecsact/Public/EcsactAsyncRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions Source/Ecsact/Public/EcsactRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
1 change: 1 addition & 0 deletions Source/Ecsact/Public/EcsactRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
1 change: 0 additions & 1 deletion Source/Ecsact/Public/EcsactSyncRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e45cb47

Please sign in to comment.