Skip to content

Instantly share code, notes, and snippets.

@mstfmrt07
Last active June 19, 2021 08:40
Show Gist options
  • Save mstfmrt07/d7cca7c8fad8f9572a8df51719769175 to your computer and use it in GitHub Desktop.
Save mstfmrt07/d7cca7c8fad8f9572a8df51719769175 to your computer and use it in GitHub Desktop.
public void OnEndDrag(PointerEventData eventData)
{
if (draggingStarted && direction != Direction.None)
{
//A swipe is detected
if (onSwipeDetected != null)
onSwipeDetected.Invoke(direction);
}
//reset the variables
startPos = Vector2.zero;
endPos = Vector2.zero;
draggingStarted = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment