> For the complete documentation index, see [llms.txt](https://soulgamess-studio.gitbook.io/easy-grid-builder-pro-2-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soulgamess-studio.gitbook.io/easy-grid-builder-pro-2-documentation/secondary-components/ui-third-person-cursor-handler.md).

# UI Third Person Cursor Handler

The **UI Third Person Cursor Handler** component is located in: <mark style="color:purple;">**SoulGames > Easy Grid Builder Pro 2 > Scripts > Grid UI Scripts**</mark> uses Easy Grid Builder Pro 2 to manage cursor behavior in third-person games. It integrates seamlessly with Unity's Input System and provides functionality for locking, unlocking, and visually updating the cursor based on user interactions.

This component is designed to work with the **EGB Pro 2 UI Third Person Cursor** prefab, located in:\ <mark style="color:purple;">**SoulGames > Easy Grid Builder Pro 2 > Prefabs > Built In UI**</mark><mark style="color:purple;">.</mark>

<figure><img src="https://2651556506-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeumhICLT4oHoEIEssOjB%2Fuploads%2FyKxqKsexGwkr4t4Lv3RH%2Fimage.png?alt=media&amp;token=e59a6631-bc72-4ccc-be20-a86045ba9e90" alt=""><figcaption></figcaption></figure>

<table data-full-width="false"><thead><tr><th width="216">Property</th><th width="429.3333333333333">Function</th><th>Required</th></tr></thead><tbody><tr><td>Cursor Pointer Panel</td><td>A UI element representing the third-person cursor pointer. This panel's visibility is updated dynamically.</td><td><mark style="color:red;"><strong>Yes</strong></mark></td></tr><tr><td>Keep Cursor Locked at Start</td><td>Determines whether the cursor is locked when the game starts</td><td>No</td></tr><tr><td>Cursor Lock and Unlock Toggle Action</td><td>An action from the Input System used to toggle the cursor lock state</td><td>No</td></tr><tr><td>Hide Cursor Pointer When Cursor Is Unlocked</td><td>Controls whether the Cursor Pointer UI Panel is hidden when the cursor is unlocked</td><td>No</td></tr></tbody></table>

***

## <mark style="color:green;">Example Use case</mark>

It is used to toggle cursor visibility in third-person or first-person games. For instance, in a third-person game, you can set the **Cursor Lock and Unlock Toggle Action** input to your inventory or menu toggle key. When this key is pressed, the game will automatically toggle the cursor’s visibility, enabling or disabling the third-person pointer. Once the menu is closed, the game will return to the third-person pointer cursor.

***

## <mark style="color:green;">API</mark>

```csharp
namespace SoulGames.EasyGridBuilderPro
```

```csharp
private void OnCursorLockAndUnlockTogglePerformed(InputAction.CallbackContext context)
// Toggles the cursor's lock state between CursorLockMode.Locked and CursorLockMode.None
// Updates the visibility of the Cursor Pointer Panel based on the new lock state
```
