I have 2 animations for an FPS arm/gun. One for hipfire and one for aiming down sights. The problem is it only plays the hipfire animation even when aiming down sights. I’m using a simple javascript in Unity 5. Is there something I’m missing?
The “Pistol001Shot” is the hipfire and the “Pistol001ShotAim” is the aim down sights.
var gunsound : AudioSource = GetComponent.<AudioSource>();
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
if (Input.GetButtonDown("Fire2"))
{
gunsound.Play();
GetComponent.<Animation>().Play("Pistol001ShotAim");
}
else if (!Input.GetButtonDown("Fire2"))
{
gunsound.Play();
GetComponent.<Animation>().Play("Pistol001Shot");
}
}
}