Created
June 11, 2018 05:06
-
-
Save harry-jung/6d44e700d293e8b8085996e9404a1ba8 to your computer and use it in GitHub Desktop.
Tick in GameInstance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is now FTSTicker::GetCoreTicker()