Hello Guest

Author Topic: Animations Play After I Left Go Of Axis.  (Read 4457 times)

Tylernocks

  • Newbie
  • *
  • Posts: 15
    • View Profile
Animations Play After I Left Go Of Axis.
« on: April 18, 2013, 08:53:30 pm »
Code: [Select]
    void Running()
        {
            anim.Play("Forward");
            anim.animationCompleteDelegate = null;
        }

I have a code here and it only plays after I let go of the button, when I hold the axis it only plays the first frame and stops.
its C#, and is active with GetAxisRaw.
« Last Edit: April 18, 2013, 10:21:12 pm by Tylernocks »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animations Play After I Left Go Of Axis.
« Reply #1 on: April 19, 2013, 10:16:31 am »
It plays the first frame and stops because you're calling anim.Play every frame. That restarts the animation every frame.

You should do this -
Code: [Select]
if (!anim.IsPlaying("Forward")) {
    anim.Play("Forward");
}