Search Unity

Cinemachine in 2D skipping frames

Discussion in 'Cinemachine' started by roseportalgames, Nov 19, 2018.

  1. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Hi guys, I have a weird issue where the Cinemachine for 2D camera sometimes skips a few frames. (I followed this blog post: https://blogs.unity3d.com/2018/07/17/cinemachine-for-2d-tips-and-tricks/ )
    See a few seconds after this point in the video, jumping right:


    If I use a normal camera with a follow script then it works fine, so I'm not sure what's happening.
    I need Cinemachine because I'm using various of their features. But the sample video is very simple so I'm not sure what could be wrong.

    Any advice on how to fix or debug this?
    Thanks. :)
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    Camera glitches are often caused by mismatched Update clocks. If your character is using physics, then its transform will by updated in FixedUpdate. In that case, you must ensure that the vcams are also updated on the same clock.

    Setting the CM Brain to SmartUpdate will allow it to update the relevant vcams on the same clock as their targets. However, that will only work if the target is consistently animated on one clock. If you mix clocks (i.e. sometimes alter the target's the transform in FixedUpdate, and sometimes alter it in Update or LateUpdate), that will confuse CM and you will get judder. Check your scripts for clock consistency.
     
    Last edited: Nov 21, 2018
    JakesFable and roseportalgames like this.
  3. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    That fixed it, thank you sooo much! :)

    I had my jump functionality partially in Update instead of FixedUpdate.
     
    Gregoryl likes this.
  4. creative_vlad

    creative_vlad

    Joined:
    Nov 9, 2016
    Posts:
    1
    Hi guys.
    I'm experiencing the same glitch only in Editor, on mobile builds camera works as intended.