I need a little help with my script. i have a problem if the animation is on the last frame and i will stop pressing the button, the animation just stop and going to first frame too fast, but if i stop pressing button in the middle of animation then it will be smoothly back animation.
And this is animation for wings of my plane.
using UnityEngine;
using System.Collections;
public class Animacje : MonoBehaviour {
void Start () {
}
void Update () {
if(Input.GetKeyDown("s"))
{
animation["S"].speed = 1;
animation["S"].wrapMode = WrapMode.Once;
animation.Play("S");
print("+1");
}
if(Input.GetKeyUp("s"))
{
animation["S"].speed = -1;
animation.Play("S");
print("-1");
}
}
}