2D Toolkit Forum

2D Toolkit => Support => Topic started by: Tylernocks on April 18, 2013, 08:53:30 pm

Title: Animations Play After I Left Go Of Axis.
Post by: Tylernocks 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.
Title: Re: Animations Play After I Left Go Of Axis.
Post by: unikronsoftware 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");
}