---
tags:
    - "Mouse"
    - "Pointer"
    - "Confined"
    - "Free"
    - "Lock"
---

# Is Cursor Locked

[Input](index.md) / **Is Cursor Locked**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Returns true if the hardware cursor is confined to the center of the window

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Is Cursor Locked")]
    [Category("Input/Is Cursor Locked")]

    [Description("Returns true if the hardware cursor is confined to the center of the window")]
    [Image(typeof(IconLockSolid), ColorTheme.Type.Blue)]

    [Keywords("Mouse", "Pointer", "Confined", "Free", "Lock")]

    [Serializable]
    public class TypeBoolInputCursorLocked : TypeBool
    {
        public override bool Get(Args args)
        {
            return UnityEngine.Cursor.lockState == CursorLockMode.Locked;
        }

        public override string ToString()
        {
            return "Cursor is Locked";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

```

