UActorComponent::SetupActorComponentTickFunction
#include "Components/ActorComponent.h"
Access: public
Description
Configures a tick function with standard component tick rules: tick after the actor, skip static or template actors, and respect the owner's pause-tick setting. Returns true if the component meets the criteria to actually tick.
Caveats & Gotchas
- • Returns false (and does not register the tick) if the owning actor is static, a CDO/template, or if the component's tick interval would never fire. Always check the return value before using the tick function.
- • Designed to be called from RegisterComponentTickFunctions, not at arbitrary runtime points. Calling it outside of the registration context may produce undefined tick ordering.
Signature
ENGINE_API bool SetupActorComponentTickFunction(struct FTickFunction* TickFunction) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TickFunction | struct FTickFunction* | The tick function struct to configure and register. | — |
Return Type
bool Example
Registering a secondary tick function C++
void UMyComponent::RegisterComponentTickFunctions(bool bRegister)
{
Super::RegisterComponentTickFunctions(bRegister);
if (bRegister)
{
if (SetupActorComponentTickFunction(&MySecondaryTick))
{
MySecondaryTick.Target = this;
// Set tick group after primary tick
MySecondaryTick.TickGroup = TG_PostPhysics;
}
}
else
{
MySecondaryTick.UnRegisterTickFunction();
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?