Mouse Position X#
Input / Mouse Position X
Can Read
Cannot Write
Description#
Returns the horizontal position of the Mouse
Code#
using System;
using UnityEngine.InputSystem;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Mouse Position X")]
[Category("Input/Mouse Position X")]
[Description("Returns the horizontal position of the Mouse")]
[Image(typeof(IconCursor), ColorTheme.Type.Blue, typeof(BadgeX))]
[Keywords("Cursor", "Screen", "Point", "Horizontal")]
[Serializable]
public class TypeNumberInputMousePositionX : TypeNumber
{
public override double Get(Args args)
{
Mouse mouse = Mouse.current;
return mouse != null ? mouse.position.ReadValue().x : 0d;
}
public override string ToString()
{
return "Mouse Position X";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}