UActorComponent::TickComponent
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtual
Description
Called every frame to update the component. Only executes if the component is registered and PrimaryComponentTick.bCanEverTick is true.
Caveats & Gotchas
- • PrimaryComponentTick.bCanEverTick defaults to false on UActorComponent. You must set it to true in the constructor before the component is registered, or ticking will never occur regardless of other tick settings.
- • Calling Super::TickComponent is required — it advances internal tick bookkeeping and fires the Blueprint ReceiveTick event. Skipping Super breaks Blueprint subclasses.
Signature
ENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DeltaTime | float | Time in seconds since the last tick. | — |
| TickType | enum ELevelTick | The kind of tick — e.g. LEVELTICK_All, LEVELTICK_TimeOnly, LEVELTICK_ViewportsOnly. Indicates whether the game is paused, running in-editor, etc. | — |
| ThisTickFunction | FActorComponentTickFunction* | The internal tick function struct that triggered this call. Can be used to inspect tick group or add tick prerequisites. | — |
Return Type
void Example
Enabling and implementing a component tick C++
// Constructor — enable tick
UMyComponent::UMyComponent()
{
PrimaryComponentTick.bCanEverTick = true;
}
void UMyComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// Per-frame logic here
ElapsedTime += DeltaTime;
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?