This question was
closed Apr 20, 2016 at 12:47 PM by
Immanuel-Scholz.
Question by
BenderB · Apr 19, 2016 at 03:26 AM ·
animationjavascriptlegacyanimationaimdownsights
Cant switch between legacy animations
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.2 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");
}
}
}
Comment