Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

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


    Jan 4, 2015
    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