GUILayer.HitTest
Scripting > Runtime Classes > GUILayer
GUILayer.HitTest

function HitTest (screenPosition : Vector3) : GUIElement

Description

Get the GUI element at a specific screen position.

Returns the GUIElement at a specific point on screen. If screenPosition is inside some GUIElement, that element is returned. Returns null if the position is not inside any GUI element. GUI elements that belong to Ignore Raycast layer will be ignored, as if they would not exist.

screenPosition is measured in screen coordinates, like the values returned by Input.mousePosition property.

See Also: GUIElement.HitTest, Input.mousePosition