Search Unity

How do i detect a swipe up or swipe left using new input system for Touch Screen

Discussion in 'Input System' started by premk, Oct 20, 2019.

  1. premk

    premk

    Joined:
    Jan 4, 2015
    Posts:
    4
    Code (CSharp):
    1. if(context.ReadValue<float>()>1)
    2.    // swipe right
    3. else
    4.    //swipe left
    My Action Type is a Value and Control Type is Touch.
    In the Binding i used Delta/X [TouchScreen]

    The behavior i noticed whether i swipe left or right it always returns positive and hence enters only the if part.
    Can someone show me an example of how to do this using new inputsystem