AActor::Tick

Override Hierarchy

Syntax

virtual void Tick
(
    float DeltaSeconds
)

Remarks

Function called every frame on this Actor. Override this function to implement custom logic to be executed every frame. Note that Tick is disabled by default, and you will need to check PrimaryActorTick.bCanEverTick is set to true to enable it.

Parameters

Parameter

Description

DeltaSeconds

Game time elapsed during last frame modified by the time dilation

Example Code

MyActor.cpp at line 6:

AMyActor::AMyActor(const FObjectInitializer& ObjectInitializer)  
{  
    PrimaryActorTick.bCanEverTick = true; //We won't be ticked by default  

    bIsMoving = false;  
    Health = 100.0f;  

    MovementVelocity.Set(0.f, 300.f, 0.f); // How far we want to move in a second  
}  

MyActor.cpp at line 18:

void AMyActor::Tick(float DeltaTime)  
{  
    Super::Tick(DeltaTime); // Call parent class tick function  

    if(bIsMoving == true )  
    {  
        UpdateOffset(DeltaTime);  
    }  

}

References

Module

Engine

Header

Runtime/Engine/Classes/GameFramework/Actor.h

Source

Runtime/Engine/Private/Actor.cpp