Version: 2023.2

HandleUtility.GetOverlappingObjects

切换到手册
public static void GetOverlappingObjects (Vector2 position, List<Object> outObjectList);

参数

position The mouse position to test.
outObjectList The list to hold the returned objects.

描述

Gets an ordered list of objects that would be picked under the give mouse position.

The position argument specifies the test location in GUI coordinates.

This function returns an unprocessed list of objects that could be either GameObjects or Components. This list also doesn't take the SelectionBase attribute or prefab roots into account.

This function must be called during a Scene GUI event that is not Repaint. It only works with the current SceneView.

Additional resources: PickGameObject, SceneView.duringSceneGui.