Upgrade to Unreal 5.5 to fix bug and get access to Visual Chaos Debugger

This commit is contained in:
2025-08-27 20:57:12 -04:00
parent 9b304985e3
commit 6e358c7eb9
12 changed files with 36 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
#include "BlueprintErrors.h"
#include "Blueprint/BlueprintExceptionInfo.h"
#include "LuaCall.h"
#include "Internationalization/TextFormatter.h"
#include "Kismet/KismetSystemLibrary.h"

View File

@@ -31,18 +31,12 @@ ALuprexGameModeBase::ALuprexGameModeBase()
//PrimaryActorTick.bCanEverTick = true; // Probably wrong
//PrimaryActorTick.bTickEvenWhenPaused = true; // Probably wrong
//PrimaryActorTick.TickGroup = TG_PrePhysics; // Probably wrong
SetActorTickEnabled(true);
SetActorTickInterval(0.0f);
ResetToInitialState();
OnWorldPreActorTickHandle = FWorldDelegates::OnWorldPreActorTick.AddUObject(this, &ALuprexGameModeBase::OnWorldPreActorTick);
OnWorldPostActorTickHandle = FWorldDelegates::OnWorldPostActorTick.AddUObject(this, &ALuprexGameModeBase::OnWorldPostActorTick);
}
ALuprexGameModeBase::~ALuprexGameModeBase()
{
ResetToInitialState();
FWorldDelegates::OnWorldPreActorTick.Remove(OnWorldPreActorTickHandle);
FWorldDelegates::OnWorldPostActorTick.Remove(OnWorldPostActorTickHandle);
}
// This method runs in the background thread,
@@ -74,6 +68,7 @@ uint32 ALuprexGameModeBase::Run() {
void ALuprexGameModeBase::ResetToInitialState()
{
Playing = false;
TickEnabled = true;
if (TangibleManager != nullptr) {
TangibleManager->ConditionalBeginDestroy();
@@ -85,6 +80,12 @@ void ALuprexGameModeBase::ResetToInitialState()
AssetLookup = nullptr;
}
// Stop the tick functions.
FWorldDelegates::OnWorldPreActorTick.Remove(OnWorldPreActorTickHandle);
FWorldDelegates::OnWorldPostActorTick.Remove(OnWorldPostActorTickHandle);
OnWorldPreActorTickHandle.Reset();
OnWorldPostActorTickHandle.Reset();
// Shut down the thread
LuprexUpdateTask.Shutdown();
@@ -256,7 +257,7 @@ void ALuprexGameModeBase::ConsoleSendInput(const FString& fs)
void ALuprexGameModeBase::OnWorldPreActorTick(UWorld* InWorld, ELevelTick InLevelTick, float deltaseconds)
{
if(Playing && (GetWorld() == InWorld) && (InLevelTick == LEVELTICK_All))
if(Playing && TickEnabled && (GetWorld() == InWorld) && (InLevelTick == LEVELTICK_All))
{
LuprexUpdateTask.Wait();
EngineSeconds += deltaseconds;
@@ -269,18 +270,12 @@ void ALuprexGameModeBase::OnWorldPreActorTick(UWorld* InWorld, ELevelTick InLeve
void ALuprexGameModeBase::OnWorldPostActorTick(UWorld* InWorld, ELevelTick InLevelTick, float deltaseconds)
{
if(Playing && (GetWorld() == InWorld) && (InLevelTick == LEVELTICK_All))
if(Playing && TickEnabled && (GetWorld() == InWorld) && (InLevelTick == LEVELTICK_All))
{
LuprexUpdateTask.Trigger();
}
}
void ALuprexGameModeBase::Tick(float deltaseconds)
{
Super::Tick(deltaseconds);
}
void ALuprexGameModeBase::BeginPlay()
{
ResetToInitialState();
@@ -341,6 +336,11 @@ void ALuprexGameModeBase::InitializeGlobalState()
LuprexUpdateTask.Startup(this);
}
if (Playing) {
OnWorldPreActorTickHandle = FWorldDelegates::OnWorldPreActorTick.AddUObject(this, &ALuprexGameModeBase::OnWorldPreActorTick);
OnWorldPostActorTickHandle = FWorldDelegates::OnWorldPostActorTick.AddUObject(this, &ALuprexGameModeBase::OnWorldPostActorTick);
}
// Initialize the asset lookup table.
AssetLookup = NewObject<UlxAssetLookup>(this);
AssetLookup->RebuildIndex();

View File

@@ -48,7 +48,6 @@ public:
ALuprexGameModeBase();
~ALuprexGameModeBase();
virtual void BeginPlay() override;
virtual void Tick(float) override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
// Delete all the state created in BeginPlay. That
@@ -181,6 +180,9 @@ public:
// True if 'BeginPlay' has been successfully completed.
bool Playing;
// This is always true unless you use the debugger to set it to false.
bool TickEnabled;
// Current Player ID
int64 PlayerId;

View File

@@ -26,8 +26,8 @@ void FTriggeredTask::Startup(FRunnable *client) {
FScopeLock lock(&Mutex);
if (Thread == nullptr) {
Client = client;
CallEvent = FPlatformProcess::GetSynchEventFromPool(true);
ReturnEvent = FPlatformProcess::GetSynchEventFromPool(false);
CallEvent = FPlatformProcess::GetSynchEventFromPool(false);
ReturnEvent = FPlatformProcess::GetSynchEventFromPool(true);
ReturnEvent->Trigger();
Thread = FRunnableThread::Create(this, TEXT("Worker Thread"));
}