How to Smooth X Axis Movement on Mobile Devices?

Hi,

I am working on an endless runner game for iOS and Android, and I am trying to simply scroll my background by at a consistent speed on the X Axis. I am currently using the below code for the background scrolling, and while the scrolling works, it is a little “jerky” and “stuttering” on iOS, and even more so on Android (I am testing using an iPhone 6, iPad Mini Retina, and Samsung Galaxy 4 Tab).

    //This should stop Unity from trying to grab the Transform component of my gameobject each frame!
    // I have dragged this gameobject into this variable in the inspector!

    public Transform		me;

    void Update ()
	{
		//Make sure that scroll speed equals MissionControl's speed!
		scrollSpeed = MCscript.speed;

		//Move to the left, consistently!
		me.Translate (Vector3.left * Time.smoothDeltaTime * scrollSpeed);
     }

I’ve looked online and found a variety of different options to try and fix this problem, and none of them have worked for me, but it seems like almost all of them involve V Sync settings which I don’t think I have control of on mobile. Can anyone help? Thanks in advance for your help, and let me know if you need anything else from me at all!

(Using Unity 5 Personal License on a MacBook Pro Retina 13inch Early 2015 model)

Update can be a bit varied in when it is called, for physics changes like this you can try using:

FixedUpdate()

Under ‘Project Settings → Physics’ you can change how often this function updates if you want a smoother change.

If this does not solve the issue and your frame rate is low on the mobile device then this issue will be hard to prevent. You may need to look into optimizing your game in that case.

you need to tell Unity to try use 60 FPS for iOS:

void Start()
{
  Application.targetFrameRate = 60;
}