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

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!

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

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

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.

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!

I’m also curious about an answer to this.