UActorComponent::OnActorEnableCollisionChanged
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtual
Description
Called on each component when the owning Actor's bEnableCollision flag changes. Override in subclasses to respond to actor-level collision toggling.
Caveats & Gotchas
- • This is an actor-level toggle, not component-level. It fires when AActor::SetActorEnableCollision is called, not when a component's own collision settings change.
- • The base implementation is empty. Subclasses like UPrimitiveComponent override this to update their physics bodies. If you override it, consider whether calling Super is needed for your class hierarchy.
Signature
virtual void OnActorEnableCollisionChanged() {} Return Type
void Example
Override to track actor collision state changes C++
void UMyComponent::OnActorEnableCollisionChanged()
{
Super::OnActorEnableCollisionChanged();
bool bCollisionEnabled = GetOwner() && GetOwner()->GetActorEnableCollision();
// Update internal state based on new collision state
UpdateCollisionResponse(bCollisionEnabled);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?