Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Walk cycle skipping first and last frame, but only when in-game?

Discussion in 'Animation' started by tHE_uKER, Nov 6, 2019.

  1. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    16
    I have defined a six-frame run cycle for a character.
    If I press play on the animator, it plays flawlessly.
    Now, problem is, when I play the game, the animation skips frames almost at random, and needless to say, it looks like c**p.
    Looking at the Animator, the animation state seems to stay on the Walking animation, with no flickering to other states, or transition arrows getting highlighted.
    Any ideas?
     
    Last edited: Nov 7, 2019
  2. MisterSkitz

    MisterSkitz

    Joined:
    Sep 2, 2015
    Posts:
    623
    What does your Animation key frames look like? I suspect that you're animating too fast and it is giving the illusion of skipping when in fact it is just animating faster than you can see. So your start may be say, 0.10 first frame, and your last keyframe 1.30. It is basically hopping from 1.30 to 0.10, and if your second keyframe is 0.50, you're hopping 0.10-0.50-1.30 which occurs over a 1.30 second span. This may appear nice, but on run you may notice actual speed of the animation gaps. Although the animation appears smooth in the Animation window, the performance on run may provide a different performance.
     
    tHE_uKER likes this.
  3. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    16
    Hey there. Thanks for the reply.

    As I said, the animation does play back flawlessly when I press play in the animator. It just looks wrong in-game, and I guarantee it's skipping just the initial and final frames (I captured it on video and frame-by-framed it).

    The animation is set to 9 samples (pretty slow) and there's a keyframe on every tick in the editor.

    Also, forgot to mention, it worked fine up until yesterday. Not sure what can be causing it.
    I'm at a loss here.
     
    Last edited: Nov 6, 2019
  4. MisterSkitz

    MisterSkitz

    Joined:
    Sep 2, 2015
    Posts:
    623
    Your Animator is the state machine, no? The Animation is different than Animator.

    So I'm confused now. Are you having an issue with the Animation or the Animator?
     
    tHE_uKER likes this.
  5. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    16
    I'm sorry. That should have been "animation tick" I guess.
    Now, I'm not sure about the question. The choppiness appears in the Game window.
    Pressing Play in the Animation window looks fine, also in the Game window.

    Something else, pretty obvious, but probably worth mentioning, is that needless to say, all of the frames' resources are where they're supposed to.
     
    Last edited: Nov 6, 2019
  6. MisterSkitz

    MisterSkitz

    Joined:
    Sep 2, 2015
    Posts:
    623
    I'm going to bed but do show a screen shot of the Animation window. Provide a video of the error you're experiencing. I really need something solid in order to help you on this.

    I'll be back tomorrow, amigo :)
     
    tHE_uKER likes this.
  7. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    16
    Will do. Thanks for the help.
     
  8. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    96
  9. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    16
    I figured it out.
    Clicking on the Walking state in the animator, I found out that I somehow accidentally created a transition from the Walking animation to itself.

    That enabled the state to transition to itself, and the thing was looping all over the place (it wasn't just skipping the first and last frames as I had initially thought).

    Deleted the transition, everyone's happy again.

    Thanks to everyone who tried to lend a hand.
     
    vhman likes this.