Pointer Delta#
Input / Pointer Delta
Can Read
Cannot Write
Description#
Returns delta movement of the Mouse, Pen or Touch pointer
Code#
using System;
using UnityEngine;
using UnityEngine.InputSystem;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Pointer Delta")]
[Category("Input/Pointer Delta")]
[Description("Returns delta movement of the Mouse, Pen or Touch pointer")]
[Image(typeof(IconCursor), ColorTheme.Type.Blue, typeof(BadgeDelta))]
[Keywords("Cursor", "Mouse", "Touch", "Pen", "Move", "Pan")]
[Serializable]
public class TypeVector2InputPointerDelta : TypeVector2
{
public override Vector2 Get(Args args)
{
Pointer pointer = Pointer.current;
return pointer != null ? pointer.delta.ReadValue() : default;
}
public override string ToString()
{
return "Pointer Delta";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}