UActorComponent::SetAutoActivate
#include "Components/ActorComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Sets whether the component should automatically activate when it is registered with the world. Only safe to call during construction scripts or before the component is registered.
Caveats & Gotchas
- • Calling this after the component has already been registered and activated has no effect on the current activation state — it only affects future registrations.
- • The UFUNCTION metadata marks this as only safe during construction scripts (UnsafeDuringActorConstruction). Calling it at runtime on an already-active component will not deactivate it; use Deactivate() instead.
Signature
ENGINE_API virtual void SetAutoActivate(bool bNewAutoActivate) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bNewAutoActivate | bool | Whether the component should automatically activate when registered. | — |
Return Type
void Example
Disable auto-activate in constructor C++
UMyComponent::UMyComponent()
{
PrimaryComponentTick.bCanEverTick = true;
SetAutoActivate(false); // Require explicit Activate() call
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?