AaronShea
(AaronShea)
November 4, 2014, 4:13am
1
I’m looking for an overridable function or event to listen for the window of the game being closed. I need to do some cleanup operations before the window can be allowed to close up.
I’ve tried Destroyed() and EndPlay() in the AGameMode class without any luck
1 Like
Hi Aaron,
I think the best way to do this. It is create custom game engine class and implement events you want.
You should add to DefaultEngine.ini
[/Script/Engine.Engine]
GameEngine=/Script/QAGame.MyCustomGameEngine
MyCustomGameEngine.h
#pragma once
#include "Engine/GameEngine.h"
#include "MyCustomGameEngine.generated.h"
UCLASS()
class UMyCustomGameEngine : public UGameEngine
{
GENERATED_UCLASS_BODY()
// When engine starts
void Init(class IEngineLoop* InEngineLoop);
// Close engine
void PreExit();
};
MyCustomGameEngine.cpp
#include "QAGame.h"
#include "MyCustomGameEngine.h"
UMyCustomGameEngine::UMyCustomGameEngine(const FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{}
void UMyCustomGameEngine::Init(class IEngineLoop* InEngineLoop)
{
Super::Init(InEngineLoop);
}
void UMyCustomGameEngine::PreExit()
{
Super::PreExit();
}
Best regards,
AaronShea
(AaronShea)
November 5, 2014, 12:57pm
3
Exactly what I was looking for
I’ve got syntax errors when trying to recompile my project Can you help me?
zikdoz
(zikdoz)
July 23, 2016, 10:38pm
5