Skip to content

Commit

Permalink
fix: use game viewport world
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Oct 10, 2024
1 parent 00d16fa commit 50f89f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/Ecsact/Public/EcsactUnreal/EcsactRunner.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "EcsactUnreal/EcsactRunner.h"
#include "EcsactUnreal/EcsactAsyncRunnerEvents.h"
#include "EcsactUnreal/EcsactUnrealExecutionOptions.h"
#include "Engine/Engine.h"
#include "Engine/World.h"
#include "Engine/GameViewportClient.h"
#include "UObject/ObjectMacros.h"
#include "UObject/UObjectIterator.h"
#include "EcsactUnreal/EcsactRunnerSubsystem.h"
Expand All @@ -25,6 +28,10 @@ UEcsactRunner::UEcsactRunner() : EventsCollector{} {
EventsCollector.entity_destroyed_callback = ThisClass::OnEntityDestroyedRaw;
}

auto UEcsactRunner::GetWorld() const -> UWorld* {
return GEngine->GameViewport->GetWorld();
}

auto UEcsactRunner::GetRunnerSubsystems()
-> TArray<class UEcsactRunnerSubsystem*> {
return RunnerSubsystems;
Expand Down
1 change: 1 addition & 0 deletions Source/Ecsact/Public/EcsactUnreal/EcsactRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class ECSACT_API UEcsactRunner : public UObject, public FTickableGameObject {
auto Tick(float DeltaTime) -> void override;
auto GetStatId() const -> TStatId override;
auto IsTickable() const -> bool override;
auto GetWorld() const -> class UWorld* override;

auto GetSubsystem(UClass* SubsystemClass) -> class UEcsactRunnerSubsystem*;

Expand Down

0 comments on commit 50f89f9

Please sign in to comment.