I want to run a block of code every tick, where do i put it?
Pastebin of the file Link
I want to run a block of code every tick, where do i put it?
Pastebin of the file Link
You put it in the Tick(float DeltaSeconds)
function.
First you have to OVERRIDE
the Tick
function in your header file because you inherit it from AActor
class.
CarGamePawn.h
virtual void Tick(float DeltaSeconds) OVERRIDE;
Then simply implement it in your source (.cpp) file.
CarGamePawn.cpp
void ACarGamePawn::Tick(float DeltaSeconds){
Super::Tick(DeltaSeconds);
// do your things here
}
Just to elaborate on the Tick
function a bit.
This function is called every frame. The parameter that is passed in called float DeltaSeconds
is the amount of time that has passed since the last frameā¦ and since Tick
is called every frame it is also the amount of time since the last call to the Tick
function.