> For the complete documentation index, see [llms.txt](https://docs.oserosuite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oserosuite.com/technical-notes/unreal-engine-notes/level-editor/select-actor-component-via-c++.md).

# Select Actor Component via C++

```cpp
USelection* SelectedComps = GEditor->GetSelectedComponents();
SelectedComps->DeselectAll();
GEditor->SelectComponent(Component, true, true, true);
GEditor->NoteSelectionChange();
```

{% hint style="warning" %}
If you don't call the deselect function then it adds the component to the selection rather than exclusively selecting it.
{% endhint %}

{% hint style="info" %}
`NoteSelectionChange()` updates the gizmo in the viewport and calls appropriate delegates.
{% endhint %}
