UActorComponent::SetActiveFlag
#include "Components/ActorComponent.h"
Access: public
Specifiers: ENGINE_API
Description
Directly sets the internal `bIsActive` flag without triggering any virtual overrides or side effects. Prefer `Activate()`, `Deactivate()`, or `SetActive()` in most cases.
Caveats & Gotchas
- • This method bypasses all virtual behaviour — `OnComponentActivated` and `OnComponentDeactivated` delegates are NOT fired. Only use it when you need to initialize the flag value before the component has registered, such as from a constructor or from replicated property handling.
- • Because it skips the standard activation path, any subsystems that react to activation changes (particle systems, audio, etc.) will not be notified. If the component is already registered, those subsystems may be in an inconsistent state.
Signature
ENGINE_API void SetActiveFlag(const bool bNewIsActive) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bNewIsActive | bool | The raw value to assign to the bIsActive flag. | — |
Return Type
void Example
Set initial active state in constructor C++
UMyComponent::UMyComponent()
{
// Start inactive; Activate() will be called after BeginPlay
SetActiveFlag(false);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?