RealDocs

UActorComponent::SetComponentTickEnabled

function Engine Blueprint Since 4.0
#include "Components/ActorComponent.h"
Access: public Specifiers: virtualUFUNCTIONBlueprintCallable

Description

Enables or disables the primary tick function for this component. Disabled components will not call TickComponent each frame.

Caveats & Gotchas

  • This only affects the primary tick function registered on PrimaryComponentTick. If a subclass registers additional FTickFunction objects, those are not affected and must be toggled separately.
  • Calling this before the component is registered (e.g. in the constructor) will have no effect because the tick function is not yet added to the world's tick list. Use the PrimaryComponentTick.bStartWithTickEnabled property instead for initial state.

Signature

UFUNCTION(BlueprintCallable, Category="Components|Tick")
ENGINE_API virtual void SetComponentTickEnabled(bool bEnabled)

Parameters

Name Type Description Default
bEnabled bool Whether to enable or disable the component's primary tick function.

Return Type

void

Example

Disabling tick when the component is idle C++
void UMyComponent::SetActive(bool bNewActive)
{
	Super::SetActive(bNewActive);
	// Only tick while active to save CPU
	SetComponentTickEnabled(bNewActive);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.