RealDocs

UActorComponent::IsOwnerSelected

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

Description

Returns true if this component's owning actor is currently selected in the editor. Useful for conditional editor-only rendering or logic that should only apply to the selected actor.

Caveats & Gotchas

  • Always returns false at runtime — this is an editor-only concept that is not relevant during Play-In-Editor or packaged builds.
  • Does not indicate the component itself is selected; only the owning actor's selection state is checked.
  • Calling this on a component with no owner (GetOwner() == nullptr) will return false without crashing.

Signature

ENGINE_API bool IsOwnerSelected() const;

Return Type

bool

Example

Draw debug helpers only for the selected actor C++
#if WITH_EDITOR
void UMyComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
    Super::PostEditChangeProperty(PropertyChangedEvent);
    if (IsOwnerSelected())
    {
        // Refresh any editor visualizers for the selected actor
        RefreshEditorVisualization();
    }
}
#endif

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.