Why is the player movement stuttering on some devices?

Hello, I just released my first game on Google Play (Glow Bounce), and it has some issues that I was unaware about with player movement stuttering. It runs perfectly smooth on my only cheap android device and within the Unity editor, so I was unaware of the problem. My friend just sent me a video of how it runs on his phone. Below are videos comparing the movement:

Link to my phone’s gameplay:

Link to other phone’s gameplay:

I’m a big noob, so I have no idea what’s causing it, but understandably, I’ve been getting bad reviews on the playstore as a result. The only things I could think of are issues with player or camera movement, but I don’t see where the problem would arise.

This is how the player is moved:

void Update()
    {
        if (controllable)
        {
            movement = Input.GetAxis("Horizontal");

            if (Input.touchCount > 0)
            {
                Touch touch = Input.GetTouch(0);

                switch (touch.phase)
                {
                    case TouchPhase.Stationary:
                        if (touch.position.x < Screen.width / 2)
                            movement = -1f;

                        if (touch.position.x > Screen.width / 2)
                            movement = 1f;
                        break;

                    case TouchPhase.Ended:
                        //stop moving
                        break;
                }
            }
//other unrelated code
}

private void FixedUpdate()
    {
        if (controllable)
        {
             RB.velocity = new Vector2(movement * speed, RB.velocity.y);
        }
//other unrelated code
}

This is how the camera is moved:

public Transform target;
    public float smoothTime = 0.3f;
    public float yOffset;

    private Vector3 currentVelocity;

    // Update is called once per frame
    void LateUpdate()
    {
        if (target != null)
        {
            if (target.position.y + yOffset > transform.position.y)
            {
                Vector3 newPos = new Vector3(0f, target.position.y + yOffset, -10f);
                transform.position = Vector3.SmoothDamp(transform.position, newPos, ref currentVelocity, smoothTime);
            }
        }

I tried moving the camera follow to regular Update() instead of LateUpdate(), but that did nothing. Any ideas on what could be causing the stuttering?

Update:

I don’t think it’s a result of modification of the timescale (I had a script that gradually sped up the game). With that removed, it looks even worse:

This is the most frustrating problem I’ve come across.

SOLVED! The issue had nothing to do with performance, it was the player movement. I was using TouchPhase.Stationary (like an idiot), which means any time the user moved their finger a pixel, it won’t register and will cause stuttering!

1 Like