Pinch to zoom acting weird on Android

I watched an Unity tutorial recently on how to write pinch to zoom script in C#. I was able to make it work just as it is supposed to work on my Samsung Galaxy Tab S 10.5, but for some weird reason it doesn’t work as it should on my phone (Sony Xperia Z2).

I also have a panning feature so the player can move the camera, this also works great on the tablet, but not on the phone.

The problem is that the zoom/pan movement is not constant, it slows down and speeds up weirdly even when I move my finger at a constant speed. Here is a video clip to demonstrate what the problem is: - YouTube

I tried using FixedUpdate() instead of regular Update(), but there is no difference at all. Here is the zoom script:

public float orthoZoomSpeed = 1.0f;
public float zoomPercentage; //Controls zoom speed
public Camera mainCamera;

void FixedUpdate () {

    zoomPercentage = (mainCamera.orthographicSize / 50.0f);

if(Input.touchCount == 2)
    		{
    			Touch touchZero = Input.GetTouch (0);
    			Touch touchOne = Input.GetTouch (1);
    
    			Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
    			Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition;
    
    			float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude;
    			float touchDeltaMag = (touchZero.position - touchOne.position).magnitude;
    
    			float deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag;
    
    
    			mainCamera.orthographicSize += deltaMagnitudeDiff * orthoZoomSpeed * zoomPercentage;
    			mainCamera.orthographicSize = Mathf.Max (mainCamera.orthographicSize, 5.0f);
    			mainCamera.orthographicSize = Mathf.Min (mainCamera.orthographicSize, 50.0f);
    
    		}

}

There shouldn’t be anything wrong with this script, as it works just fine with the tablet. Does anybody have any idea why it doesn’t work correctly on the phone? I can’t publish anything with this script if I can’t get it to work properly, really annoying problem!

Your code should use regular Update() for this, or else you might lose input, since the Input class polls at Update() rate not FixedUpdate(). Other than that your script looks fine and I don’t know of any particular issue with touches on Android. Maybe you can test on another device and see if its a device issue. And of course you should test your script in a demo scene with nothing else going on. There could always be some interference with other code, UI elements or what not.