# HitTest

> Is a point on screen inside the element?

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.IMGUIModule

## HitTest(Vector3)

Is a point on screen inside the element?

> **Warning:**
>
> **Removed.** GUIElement has been removed. Consider using [https://docs.unity3d.com/ScriptReference/UIElements.Image.html](https://docs.unity3d.com/ScriptReference/UIElements.Image.html), [https://docs.unity3d.com/ScriptReference/UIElements.TextElement.html](https://docs.unity3d.com/ScriptReference/UIElements.TextElement.html) or TextMeshPro instead.

```csharp
public bool HitTest(Vector3 screenPosition)
```

### Parameters

**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

Returns true if the screenPosition is contained in this GUIElement. screenPosition is specified in screen coordinates, like the values returned by the [Input.mousePosition](/engine/6000.0/script-reference/unityengine/input/mouseposition.md) property. If no camera is given a camera filling the entire game window will be assumed.

Note that if the position is inside the element, true will be returned even if the game object belongs to Ignore Raycast layer (normally mouse events are not sent to Ignore Raycast objects).

Additional Resources: HitTest.

## HitTest(Vector3, Camera)

Is a point on screen inside the element?

> **Warning:**
>
> **Removed.** GUIElement has been removed. Consider using [https://docs.unity3d.com/ScriptReference/UIElements.Image.html](https://docs.unity3d.com/ScriptReference/UIElements.Image.html), [https://docs.unity3d.com/ScriptReference/UIElements.TextElement.html](https://docs.unity3d.com/ScriptReference/UIElements.TextElement.html) or TextMeshPro instead.

```csharp
public bool HitTest(Vector3 screenPosition, Camera camera)
```

### Parameters

**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): **** (\[Camera]\(/engine/6000.0/script-reference/unityengine/camera)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

Returns true if the screenPosition is contained in this GUIElement. screenPosition is specified in screen coordinates, like the values returned by the [Input.mousePosition](/engine/6000.0/script-reference/unityengine/input/mouseposition.md) property. If no camera is given a camera filling the entire game window will be assumed.

Note that if the position is inside the element, true will be returned even if the game object belongs to Ignore Raycast layer (normally mouse events are not sent to Ignore Raycast objects).

Additional Resources: HitTest.
