I’m using FTicker to run code in a class that doesn’t extend UObject. This works just fine. However the function doesn’t stop getting called, even if the game is stopped in the editor. It still continues to tick away and give me output in the log.
TickDelegateHandle = FTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateRaw(this, &ConnectionManager::Tick), 1.0f);
Tick function
bool ConnectionManager::Tick(float DeltaTime)
{
UE_LOG(LogTemp, Warning, TEXT("ConnectionManager::Tick"));
return true;
}
As far as I can tell the destructor never gets called:
ConnectionManager::~ConnectionManager()
{
UE_LOG(LogTemp, Warning, TEXT("ConnectionManager::~ConnectionManager"));
FTicker::GetCoreTicker().RemoveTicker(TickDelegateHandle);
}
I’ve been trying to use other engine examples of FTicker but so far i’m at a loss.
EDIT:
I managed to stop the ticks by creating my own GameInstance and forcing ~ConnectionManager() on the GameInstance Shutdown() function. This seems like the wrong solution though.