Why is my transform "stuttering" when I move it?

I know that there are several questions, but none of them could help me out :frowning:

I have a Scene that just contains a Transform and the (non moving) Camera,
and the only thing the Transform does is:

this.transform.Translate(Vector3.left * speed * Time.smoothDeltaTime);
		
		if(this.transform.position.x < -200)
			this.transform.position = new Vector3(200, this.transform.position.y, this.transform.position.z);

Of course this Codesample is in the "Update"Method, I tried it with fixedUpdate, lateUpdate and also with time.DeltaTime, fixedDeltaTime…and so on,

i tried it with Vsync off, vsync every vertical blank and every second vertical blank, but there was no option how to get rid of the stuttering.

Sometimes its a bit better, sometimes its horrible.
Without vsync for example, it looks like some parts of the Transform are faster moving than others, and it looks very very “glitchy” - with vsync one i have constantly “jumps” in the movement.

My Screen is running at 60hZ. The drivers are up to date - and I am really frustrated in this topic :frowning:

So if somebody could help me, it would be great!
Kisses and hugs for the “problem-solver” :stuck_out_tongue:

Couple things, if you don’t cache your transform the script is attached to, it’s akin to using GetComponent each time you use ‘this.transform’, this can add up really quickly.

Since it hidden with in the text:

Little known fact: all of the component accessors in MonoBehaviour, things like transform, renderer, and audio, are equivalent to their GetComponent(Transform) counterparts, and they are actually a bit slow. GameObject.FindWithTag has been optimized, but in some cases, for example, in inner loops, or on scripts that run on a lot of instances, this script might be a bit slow.

Also it’s better to copy the position struct, make modifications and assign it back, this directly applies to c#, though under the covers Java/UnityScript is performing this same action.

See if this is helpful.

using UnityEngine;
using System.Collections;

public class MovementText : MonoBehaviour {
	float speed = 2.0f;
	Transform me;
	Transform cam;
	// Use this for initialization
	void Start () {
		me = this.transform; // Cache Transform of script attached to object, otherwise GetComponent is used each time.  This changes in Unity 5.
		cam = Camera.main.transform;
	}
	
	// Update is called once per frame
	void Update () {
		me.Translate(Vector3.left * speed * Time.deltaTime, cam);
		if(me.position.x < -200)
		{
			//Instantiating can be costly, copy the struct and reapply to object
			Vector3 posCopy = me.position; // You retain the original values, modify what you need.
			posCopy.x = 200;

			me.position = posCopy;
		}
	}
}

Have you tried to implement physics for that object? Given a speed, you can determine the distance (current position of your object) in a given time. Speed = distance / time => distance = speed * time.
I’ll give you a short example:

public class script : MonoBehaviour
{
	private float speed = -2f;
	private Vector3 startPosition;
	private float startTime;
	private static Vector3 currentPosition;

	void Start ()
	{
		startTime = Time.time;
		startPosition = new Vector3 (this.transform.position.x, this.transform.position.y, this.transform.position.z);
	}

	void Update ()
	{
		float elapsedTime = Time.time - startTime;
		currentPosition = new Vector3(startPosition.x + (speed * elapsedTime), startPosition.y, startPosition.z);
	}

	void LateUpdate ()
	{
		this.transform.position = currentPosition;
	}
}