Odd Animation Error

Thanks guys, its working now!

//Written By/For Gibson Bethke

//Clip Variables
var fullClip : int = 30;
var currentClip : int = 30;
var reloadAnimation : Animation;

//Time Variables
var fireTime : float = 0.1;
var reloadTime : float = 3;

//GUI Variable
var guiObject : GUIText;
var guiObject2 : GUIText;

enum GunState {ReadyToFire, Cooldown, Reloading};
var currentState = GunState.ReadyToFire;

function Start(){
	guiObject.guiText.text = "Ammo Remaining In Clip: " + currentClip;
	guiObject2.guiText.text = "Max Ammo: " + fullClip;

}

//Update function
function Update () {
	if(Input.GetMouseButton(0)){
		Fire();
	}
	if(Input.GetMouseButton(1)) {
		Reload();
	}
}

//Fire Function
function Fire () {
	if(currentState == GunState.ReadyToFire){
		Debug.Log("Left Mouse Button Pressed");
		currentClip -=1;
		if (currentClip == 0) {
			Reload();
		} else {
			currentState = GunState.Cooldown;
			WaitForCooldown();
		}
	}
}

//Reload Function
function Reload () {
	if(currentState == GunState.ReadyToFire){
		reloadAnimation.Play();
		Debug.Log("Right Mouse Button Pressed");
		currentState = GunState.Reloading;
		guiObject.guiText.text = "Reloading...";
		WaitForReload();
	}
}

function WaitForCooldown() {
	yield WaitForSeconds(fireTime);
	currentState = GunState.ReadyToFire;
	guiObject.guiText.text = "Ammo Remaining In Clip: " + currentClip;
}

function WaitForReload() {
	yield WaitForSeconds(reloadTime);
	currentClip = fullClip;
	currentState = GunState.ReadyToFire;
	guiObject.guiText.text = "Ammo Remaining In Clip: " + currentClip;
}

I haven’t started animating my game yet, but how about reloadAnimation.Play()?

I just tried that… it didn’t work.

I see that reloadAnimation is an AnimationClip, while Play() is a function of the Animation class, now the AnimationClip class, so this would be why it is not working. As for how to fix it, I’m not sure.

Well, I fixed it by giving the gun animation component, and changing the reloadAnimation variable to

var reloadAnimation : Animation;

Thanks for all your help!