How do I make my script switch back to my regular animations

OK so here is my code in javascript
function Start () {
animation[“Shoot”].wrapMode = WrapMode.Once;
animation[“Shoot”].layer = 1;
animation.Stop();
}

function Update () {
	
	if (Input.GetAxis("Horizontal") > 0.3) {
		animation.CrossFade("walk");
};
	else if (Input.GetAxis("Vertical") > 0.3) {
		animation.CrossFade("walk");
};
	else if (Input.GetAxis("Vertical") < -0.3) {
		animation.CrossFade("walk");
};
	else if (Input.GetAxis("Horizontal") < -0.3) {
		animation.CrossFade("walk");
};
	else {
		animation.CrossFade("idle");
};
		 
	
	if (Input.GetButtonDown ("Fire1")) {
		animation.CrossFade("Shoot");
};
	if (Input.GetButtonDown("Fire2")) {
		animation.CrossFade("zoom");
};
}

I have it set so if I press “Fire2” it will play a special zoomed in animation, however, when I release mouse2, my idle and walking scripts won’t play. The only way I got them to play in game was by shooting when i am zoomed in, otherwise it doesn’t work

It seems like that is the legacy animation system. I believe you would need to tell it to go back on a default animation either using the mecanim system or in your if-else statements.

The mecanim way is done by Unity, if there is no animation state set then it plays the default.

However, if not using it I think you would need to tell it to animate the default animation you want.