- Home /
Why incrementing transform.position causes jitter on iOS
Hello, I am having some problems with a simple script which causes jitter on the sprite. All the script does is public float speed; void Update () { var pos = transform.position;pos.y += speed * Time.deltaTime;transform.position = pos; }
This code runs fine in Editor, or standalone builds. But when I try to run it on my iOS device, you can see some jittering. The scene has 3 gameobjects with the above script and there is no rigidbody physics. Its just three objects falling without any physics. Edit: The FPS on iPhone is a constant 30 which makes it more weird
Any idea why it causes jittering?
Thanks
Answer by FlashX · Nov 16, 2015 at 06:08 AM
have you tried using int rather than float? Just wondering if maybe it has something to do with the numbers after the floats decimal point? Of course this will make your game run strange but it might help you narrow down the issue?
tried using int. still same issue. I am pretty sure it has something to do with dt but I have tried LateUpdate with smoothDeltaTime deltaTime and the same with Update. It runs with some jittering when using Update/LateUpdate and horribly with FixedUpdate which is obvious
Just tested your code and there doesnt seem to be any issues with both update and lateUpdate, are you sure there is nothing conflicting with it? Is the camera somehow attached to the object and has some sort of delayed positioning system on it causing it to appear jittery?
Try testing the code in a brand new file and see if you have the same result, if you don't then theres something else wrong in your scene