Skip to content

Instantly share code, notes, and snippets.

@harry-jung
Created June 11, 2018 05:06
Show Gist options
  • Save harry-jung/6d44e700d293e8b8085996e9404a1ba8 to your computer and use it in GitHub Desktop.
Save harry-jung/6d44e700d293e8b8085996e9404a1ba8 to your computer and use it in GitHub Desktop.
Tick in GameInstance
//.h file
void Init() override;
void Shutdown() override;
bool Tick(float DeltaSeconds);
FDelegateHandle TickDelegateHandle;
// .cpp file
bool UYourGameInstance::Tick(float DeltaSeconds)
{
// Do your logic
return true;
}
void UYourGameInstance::Init()
{
// Register delegate for ticker callback
TickDelegateHandle = FTicker::GetCoreTicker().AddTicker(FTickerDelegate::CreateUObject(this, &UYourGameInstance::Tick));
Super::Init();
}
void UYourGameInstance::Shutdown()
{
// Unregister ticker delegate
FTicker::GetCoreTicker().RemoveTicker(TickDelegateHandle);
Super::Shutdown();
}
@T5MattijsvanDelden
Copy link

It is now FTSTicker::GetCoreTicker()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment