Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Cursor Lock State#

Input / Cursor / Cursor Lock State

Description#

Returns true if the mouse cursor is in the chosen lock state

Parameters#

Name Description
Lock State The lock state the cursor is compared against

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Cursor Lock State")]
    [Category("Input/Cursor/Lock State")]
    [Description("Returns true if the mouse cursor is in the chosen lock state")]

    [Image(typeof(IconCursor), ColorTheme.Type.Blue)]
    [Keywords("Mouse", "Pointer", "Lock", "Locked", "Confined", "Free")]

    [Parameter("Lock State", "The lock state the cursor is compared against")]

    [Serializable]
    public class ConditionCursorLockState : Condition
    {
        [SerializeField] private CursorLockMode m_LockState = CursorLockMode.Locked;

        protected override string GetTitle(GameObject source)
        {
            string className = TextUtils.ThemeAsKeyword("Cursor");
            string member = TextUtils.ThemeAsKeyword("Lock State");
            return $"{className} {member} is {this.m_LockState}";
        }

        protected override bool Run(Args args)
        {
            return Cursor.lockState == this.m_LockState;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.