GameObjects jittering/stuttering for a 2D minimal case in Android.

Edit : Problem Solved by disabling “Optimized Frame Pacing”, “Multithread Rendering” and Vulcan.

Altough it introduces some other issues on some devices (see my last comment), it works infinitely better than when those parameters were toggled.

Hello everybody,

So after trying everything searching the whole internet and implementing any solution remotely relatable, i’ve opted for re-installing unity and scratching the project to the bones : the most minimal case as it is often recommended here to identify where the problem comes from.

I’ve started a new project where i have barely just camera moving, and some gameobjects.

Here is a video of the jitter : 20240425_212637.mp4 - Google Drive

it happens around second 8 or 9 to give just one example (but actually it happens 3 to 4 times in the video, that’s just the clearest example from this bad recording) : The GameObject seems to stop and reload again & sometimes it seems as if the whole screen stutters.

Parameters of the game object : Imgur: The magic of the Internet

Here is the code for the gameobject.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PrototypeWhiteCat : MonoBehaviour
{

  
    private Rigidbody2D rb;
 
    void Start()
    {
           rb = GetComponent<Rigidbody2D>();
    }

}

Code of the Camera Movement.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class cameraMovement : MonoBehaviour
{
 
    public static float cameraSpeed;


    void Start()
    {

        QualitySettings.vSyncCount = 0;
        Application.targetFrameRate = 60;
        cameraSpeed = 6f;

     
    }


    private void Update()
    {
        transform.position += new Vector3(cameraSpeed * Time.deltaTime, 0, 0);

    }
  

}

The camera is set inside a simple GameManager, like this : Imgur: The magic of the Internet

The problem happens whether i put the transform.position of the CameraMovement into Update, LateUpdate or FixedUpdate.

It happens whether i have a camera moving or just the GameObject moving either with transform/rb.velocity or lerp.

At first i had a SpawnCats script, but to get a really minimal case, i removed it and put just some 10 GameObjects in the game screen.

I’ve tried in a second device and still : the same problem. The only solution i’ve still haven’t tried is prayers.

If anyone has even an inkling of a hint of where the problem may come from, i would be forever grateful.

Thanks in advance.

You need to turn interpolation on for the Rigidbodies.

Already did and it didn’t solve the problem.

Plus i’ve read that it’s too ressource intensive to use for multiple game objects. (in my game 3 to 5 cats appear every second or so).

It’s certainly one of the things you need to do.

Interpolation is really the only way to have non-jittery moving Rigidbodies, so you don’t have much of a choice. Your choices are eat the performance cost or have jittery objects. The costs are overstated.

Remove the Application.targetFrameRate and see if that helps. On mobile the device will typically dictate the frame rate.

That’s the way i started, i’ve changed the FrameRate to try to solve this stutter problem.

Whenever i put any modification, like changing the framerate, putting interpolate or no interpolate, it changes things only in the margins, the movement becomes stable for 7 instead of 5 or 4 seconds or so, then the unavoidable sudden big stutter happens !

Thank you for the information and for your time. Interpolate was the first thing that was recommended to me, but unfortunately it doesn’t solve the problem.

Problem solved by disabling “Optimized Frame Pacing”, “Multithread Rendering” and Vulcan.

Thanks to this post Unity 2021/2022 laggy/stuttering Android performance compared to Unity 2020

Now it works perfectly on some devices, but on others, as user @Starbust999 explained on that post

For me on Android, I had this issue if “Optimized Frame Pacing” (swappy) wasn’t toggled on device that have a 90hz screen. Even if targetFrameRate was set to 60 (seems it round it off to 45, 90/2). Which really sucks as a default behaviors, the only other workaround (beside toggling swappy to true) is to tweak the UnityPlayerActivity in java to pick a specific screen that runs at 60hz but that introduce other issues…

But still, even in those devices it works way better than when “Optimized Frame Pacing” was toggled.

Now i just have to learn how to inject custom java code.