Hello all,
Here is an extremely basic C# script that I wrote to test out a walking animation. I will go back later in the project and hopefully add booleans to control it so I can add jumping animations and the like. I have the walking animation all done. It is attached to the pistol model, and to make sure I dragged the animation to the pistol as well. I then dragged this script to it. I click play and it just plays the animation over and over no matter what I do. I just want some light shed on what I am doing wrong. Thanks.
using UnityEngine;
using System.Collections;
public class walkinanimationpistol : MonoBehaviour {
void Update () {
if (Input.GetKeyDown ("w")) {
animation.Play("NameOfWalkingAnim");
} else {
animation.Stop("NameOfWalkingAnim");
}
}
}