Search Unity

[FPS] Animation looping issue

Discussion in 'Animation' started by Pedrohcg, Aug 8, 2015.

  1. Pedrohcg

    Pedrohcg

    Joined:
    Mar 25, 2015
    Posts:
    15
    Good night everyone, I'm currently having a problem with animating a gun in a First Person Shooter.

    I'm trying to animate an Aim state, Sprinting state and Shooting state but all of the animations are looping.

    I already unchecked the "loop time" in the animations and they keep looping while I hold the desire key.

    Here are the codes and mecanim:
    animationhelp1.png



    Sprinting and aim script (I'm using the standard FPS controller from unity):
    animationhelp2.png

    Shooting script:
    animationhelp3.png



    That how I used to animate in previously versions and had no problems, but now I get this issue.
    If anyone can help, thanks in advance.
     

    Attached Files:

  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    My first guess would be that your any state transition is what make you thing that your state is looping.

    If your transition's condition from any state to aim is aim == true then each time the controller parameter aim is true this transition will occur even if you are already in the aim state.
     
  3. GokusGString

    GokusGString

    Joined:
    Jun 13, 2015
    Posts:
    1
    Hi, I'm not sure if you're still looking for an answer, but for any one else out there I found a solution that worked for me.

    Simply select the transition and uncheck the Can Transition To option under settings.

    Hope this saves someone from the struggle of why the animation keeps looping.
     
    SkippyBun and tejaskhorana like this.
  4. VALIKCOOL

    VALIKCOOL

    Joined:
    Jan 8, 2015
    Posts:
    3
    Thanks a lot, from 2016!!
     
  5. tejaskhorana

    tejaskhorana

    Joined:
    Feb 25, 2017
    Posts:
    1
    Thanks AGAIN, from 2k17!
     
  6. SkippyBun

    SkippyBun

    Joined:
    Aug 8, 2019
    Posts:
    1
    Thank you from 2020