0
\$\begingroup\$

I'm trying to find the solution for 46 hours now and I'd be really happy if someone knows it!

I'm using a DOTween library for moving the objects. I also use LeanTween, cause I heard it's faster but none of these work for me in this case. I've used tweening libraries alot, but never faced an issue like this.

The bug appeared in my project, so to check it I created a blank one. An empty scene, with a camera and one cube with scale[10,2,10].

Now, I've added a simple script:

    Sequence sequence = DOTween.Sequence();

    sequence.Insert(0f, transform.DOMove(transform.position + new Vector3(10f,0f,0f),1f)).SetEase(Ease.Linear);
    sequence.Insert(1f, transform.DOMove(homePosition,1f)).SetEase(Ease.Linear);
    sequence.SetDelay(1f);
    sequence.SetLoops(-1);

The script moves the cube continously by 10 units to the right, and back (both in 1 second).

There's a noticable jitter.

This jitter is strange, cause it does not happen contantly. It choses a time and just freezes the cube in place for a really tiny amount of time which is noticable - when you see a smoothly moving object and it freezes for a moment.

As you can see, there's a linear interpolation, but I've tried with many (it's even better visible with other interplation types).

Now. The profiler is not the case, cause I've tested it on the empty project with one object on the scene.

Things I've already tried:

  • Turning off occlusion culling
  • Turning off everything I could
  • All the combinations of quality settings
  • LeanTween instead of DoTween

The one thing I came up with is the profiler's WaitForTargetFramerate. By definition, when WFTF is huge it means that the app is doing well, cause it finished it's work and waits for the next frame. In my opinion in this case it's the reason of the bug.

I have a screenshot of the profiler window (with one cube, one directional light and this script attached to a cube):

Now, I'm not 100% sure, but I think that this jitter may happen on these V-Sync drops on the screen.

Everything is tested on the PC. On Android there's the same thing (a noticable jitter), but I didn't run the profiler.

If someone has any idea what may be the cause of this - I'd be grateful. I'll put a bounty here as soon as I can, cause I'm really tired! :) enter image description here

@ DMGregory

This is before the 'jump' on the GPU chart: enter image description here

and that's on the 'jump': enter image description here

There's no RigidBody or Collider, but on my main project there are box colliders on these floors. I've also tried adding RB with the Interpolation checked. No difference.

@ Josh Hamilton

Even if this is a normal behavior, that the frame completed faster - there are games on Google Play and AppleStore without any glitches like this. In my main project (where I discovered the issue) the biggest problem is that this lag is happening when I move the camera to follow the player smoothly and the freeze it noticable like anywhere else. Like the entire enviroment was freezing for 1-3 frames.

\$\endgroup\$
6
  • \$\begingroup\$ Do you get any details about what's in that purple "other" category on the GPU? Is that the WaitForTargetFramerate or something else? Also, does your object have any physics components like a collider or rigidbody? \$\endgroup\$
    – DMGregory
    May 3, 2017 at 22:26
  • \$\begingroup\$ Turn off Vsync and try setting a target framerate (change it a few times try values like 30, 45, 60), see if that changes anything. Those dips shouldn't be anything bad because it just means that frame was done faster than the others. \$\endgroup\$ May 4, 2017 at 4:57
  • \$\begingroup\$ I've edited my question, added answers to your questions. Thank you both for your attention :) \$\endgroup\$
    – Jacob
    May 4, 2017 at 6:51
  • \$\begingroup\$ I've also read yesterday that this may be caused by physics & non-physics systems collision. On my main project some objects are being moved with physics (the player) and the camera and floors are moving with tweens (velocity, transforms) \$\endgroup\$
    – Jacob
    May 4, 2017 at 6:53
  • \$\begingroup\$ Where is your script located? Start? \$\endgroup\$
    – McAden
    May 4, 2017 at 23:35

0

You must log in to answer this question.

Browse other questions tagged .