# What's the API editor use to select a actor?

**URL:** <https://forums.unrealengine.com/t/whats-the-api-editor-use-to-select-a-actor/453944>\
**Category:** Mobile\
**Tags:** unreal-engine, editor, question\
**Created:** [August 16, 2019, 6:37am UTC](https://forums.unrealengine.com/t/whats-the-api-editor-use-to-select-a-actor/453944 "2019-08-16T06:37:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_8761af6d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8761af6d](https://forums.unrealengine.com/u/anonymous_user_8761af6d)\
**Post date:** [August 16, 2019, 6:37am UTC](https://forums.unrealengine.com/t/whats-the-api-editor-use-to-select-a-actor/453944/1 "2019-08-16T06:37:15Z")

</div>

In editor, we can select any actor by left mouse click, even if the collision of selected actor is set to disabled. Apparently editor doesn’t use “LineTraceByXxx” to detect which actor is selected.

My question is: Which API editor use to select actor? Can this API be used by game logic?

I’m new to unreal and never read the UE source code. I have no idea which file I can find this answer by myself. It will be nice if you could tell me where I can find!!!

Thanks for any answer!

---

<div class="post-metadata">

**Author:** ![Orfeas\_El](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Orfeas\_El](https://forums.unrealengine.com/u/Orfeas_El)\
**Post date:** [August 17, 2019, 7:14am UTC](https://forums.unrealengine.com/t/whats-the-api-editor-use-to-select-a-actor/453944/2 "2019-08-17T07:14:07Z")

</div>

In order to get a reference of the selected objects you can use the GetSelectedActors function located here:

> **[UEditorEngine::GetSelectedActors](https://docs.unrealengine.com/4.27/en-US/API/Editor/UnrealEd/Editor/UEditorEngine/GetSelectedActors/)**
>
> Returns the set of selected actors.

The next step in order to get a specific actor class from the selection above is to call the GetSelectedObjects functions inside USelection class:

> **[USelection::GetSelectedObjects](https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Engine/USelection/GetSelectedObjects/1/)**
>
> Fills in the specified array with all selected objects of the desired type.

I doubt this logic can be used by a shipped game, however you can use it inside an Editor plugin or maybe during your development.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8761af6d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8761af6d](https://forums.unrealengine.com/u/anonymous_user_8761af6d)\
**Post date:** [August 19, 2019, 1:13pm UTC](https://forums.unrealengine.com/t/whats-the-api-editor-use-to-select-a-actor/453944/3 "2019-08-19T13:13:57Z")

</div>

Thanks for your detailed answer!! That’s help a lot!

I also wonder how editor know which actors is considered selected when left mouse button is clicked?  
Generally, in game logic we will project the location of cursor to world space (FVector Start, FVector End) and then use LineTraceByChannel to find which actors is under cursor when clicking. This solution require the collision of actors is enabled.

However, we can select collision-disabled actors in editor by left mouse button. How editor achieve? What happen between “clicking on level editor” and “actors is marked selected”?

Thanks your patient answer again!

---

<div class="post-metadata">

**Author:** ![EJaworenko1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ejaworenko1/32/575974_2.png) [@EJaworenko1](https://forums.unrealengine.com/u/EJaworenko1)\
**Post date:** [May 11, 2023, 4:46pm UTC](https://forums.unrealengine.com/t/whats-the-api-editor-use-to-select-a-actor/453944/4 "2023-05-11T16:46:16Z")

</div>

I’m also curious about an answer to this.
