Hi, I am making a simple game like Curve Fever. I have simple scene with few GameObjects and one dot which is moving linearly. The problem is that the movement is not smooth - only on very powerful devices which is weird because there is not much in the scene. On my phone i can see little lags, background is "jumping". I tried many things:
using Translate/MoveTowards/Lerp in different combinations
using Update/FixedUpdate/LateUpdate also with decreasing time between FixedUpdate calls
changing quality settings like Vsync
removing everything from scene (like canvas), only moving object was active
even I was testing with animation changing the position of object
So do you have any ideas what is wrong? Game was tested on many devices and the problem is repeating.
Object has Rigibody2D (kinematic) and circle collider.
Edit: Current code:
transform.Translate(Vector2.up * speed * Time.fixedDeltaTime, Space.Self);
if (direction != 0)
rotationSpeed = 2 * speed * radius;
transform.Rotate(Vector3.forward * -direction * rotationSpeed * Time.fixedDeltaTime);
speed += speedIncrease * Time.fixedDeltaTime;
But as I said i tried many other versions and still only powerfull phones can handle it
Check if you have 60 fps.
Post code, maybe you implement something wrong. (Remember: Time.fixedDeltaTime is for FixedUpdate and Time.deltaTime you using in Updates and LateUpdates)
If game object contains rigidbody set interpolation on.
@Masterio 1. Stable 45fps on my phone 2. I pasted the code 3. GameObject hast interpolation on now but still it is not perfect smooth movement ;/
It should be in Update. Next check profiler maybe you have some scripts what use a lot of cpu. Camera moves should be in LateUpdate.
Restore FicedUpdate refresh time to default 0.2
But I need to use FixedUpdate because game will be using multiplayer and i want to have equal steps between updates Also i checked profiler and founf that Graphics.graphics.presentandsync is using a lot of CPU. Now i am searching what is wrong with rendering(?)
@fazol Can you post the camera code too , You need to sync both to get smooth movement
Camera is attached to gameObject. There isn't any script to move camera
Answer by ceandros
Mar 14 at 06:10 PM
Try using Update() and Time.deltaTime,
Increase or decrease the fixed update interval to a multiple of your ideal framerate
Activate "interpolate" on your rigidbody2d (if you don't have one, add it, remove gravity, set as kinematic)
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
8 People are following this question.
Android performance hit on changing Button.Interactable
Bad performance on certain android devices
Realistic metalic on mobile
2D Smooth movement and collision detection problem
Character controler Script