Is Cursor Locked#
Input / Is Cursor Locked
Can Read
Cannot Write
Description#
Returns true if the hardware cursor is confined to the center of the window
Code#
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;
}
}