UActorComponent::Deactivate
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Deactivates the component if it is currently active. Clears bIsActive and fires OnComponentDeactivated. Subclasses override this to stop ongoing behavior (particles, audio, movement).
Caveats & Gotchas
- • Deactivating a component does NOT unregister it or stop its tick unless the component's tick group is set to only tick when active. The component remains registered with the actor — only bIsActive is cleared.
- • Marked UnsafeDuringActorConstruction — safe to call in BeginPlay and later, but not inside the C++ constructor or Blueprint construction script.
- • Particle system and audio components override Deactivate() to stop emission/playback. Calling Deactivate() on a base UActorComponent subclass that doesn't override it only updates the flag and fires the delegate.
Signature
UFUNCTION(BlueprintCallable, Category="Components|Activation", meta=(UnsafeDuringActorConstruction="true"))
ENGINE_API virtual void Deactivate(); Return Type
void Example
Pause a component on ability cooldown C++
void AMyCharacter::OnAbilityCooldownStart()
{
if (CooldownIndicatorComponent)
{
CooldownIndicatorComponent->Activate(); // start showing cooldown
}
}
void AMyCharacter::OnAbilityCooldownEnd()
{
if (CooldownIndicatorComponent)
{
CooldownIndicatorComponent->Deactivate();
}
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?