Is it the way to find Swipe Speed.

hey i am making flick football type game and when i swipe ball with finger i want it recognize the amount of finger that i used for swipe… and according to it gets speed… plz help me out guys thanks in advance

you are not setting the speed value in this code, still speed is distance/time and if you are using distance as a vector2, and will be divided by a scalar value, then the result will be a vector2,

foreach(Touch touch in Input.touches)
{
   if(touch.phase == TouchPhase.Began)
   {
      startPos = touch.position;
      startTime = Time.time;
   }
   if(touch.phase == TouchPhase.Ended)
   {
      endPos = touch.position;
      diffTime = Time.time - startTime;
      startTime = 0;
   }
   distance = Vector2.Distance(startPos,endPos);
   if(diffTime != 0)//<<<<<
      speed = distance / diffTime;//<<<<<<<<
}
 
if (speed != Vector2.zero)
{
   Target.AddForce(speed/20*(distance/diffTime));
   Debug.Log("startTime / diffTime = " + startTime + " / " + diffTime);
   speed = Vector2.zero;
   diffTime = 0;//<<<<<<<<
}