Hi, i’m using the new input system.
I created the input actions to get 2 actions:
Move(Value, Vector2): bound to mouse position and touchscreen primary touch position
Select(Button): bound to mouse left button and touchscreen press
I created this listener but i can’t find a way to generically get the click/press position when i get the Select action
public void inputEventListener(CallbackContext value) {
if(value.action.name=="Move")
{
if(pressing)
{
print(this.gameObject.name + " MOVE " + value.ToString());
Vector2 currentPosition = value.ReadValue<Vector2>();
Vector2 deltaMove = currentPosition - dragStart;
print(this.gameObject.name + " DELTA MOVE " + deltaMove);
}
} else if (value.action.name == "Select") {
if(value.phase == InputActionPhase.Started)
{
print(this.gameObject.name + " SELECT START " + value.ToString());
//this works only for the mouse
dragStart = Mouse.current.position.ReadValue();
pressing = true;
} else if (value.phase == InputActionPhase.Canceled)
{
print(this.gameObject.name + " SELECT STOP " + value.ToString());
pressing = false;
}
}
}