Not sure why animation plays automatically

Let’s get this out of the way now:

“Play automatically” is not checked.

The loop mode is set to “once.”

In the script there is a condition check which says

“if you have 10 photos, the animation will play.”

And yet, the animation plays right from the beginning.

Scratching my head on this one, because I’m guessing that the answer is so simple that I’ll kick myself for not thinking of it. So hey, I’m hoping you’ll kick me. Err, help me. Any help is humbly appreciated. God bless.

Animation Script: - Please note: also tried in Update

function Start (){ 
if(CameraFlash.picture >= 10);
gatefall();
}


function gatefall () {
yield WaitForSeconds(1.0);
animation.Play();
}

Photo Script

var flash : GameObject;
var    cameraSound : AudioClip;
static var picture : int = 0;
static var takepicture : boolean = false;

function Start() {
flash.SetActive(false);
}

function Update() {
if(Input.GetButtonDown("Sword Slash")){
if(Inventory.inventoryArray[4] >= 1)
{
AudioSource.PlayClipAtPoint(cameraSound, transform.position);
picture++;
takepicture = true;
flash.SetActiveRecursively(true);
StopFlash();
}
}
}

function StopFlash() {
yield WaitForSeconds(1.0);
flash.SetActiveRecursively(false);
}

1 Answer

1

Hehe, this one gets me all the time. You have a semicolon at the end of your if statement for the picture > 10 check.

Good catch ;) It's hard to read such badly formatted code.

supernat, you're awesome, thank you so much!!!! Bunny: congratulations, you had you're moment, and your precious Karma score went up. Hope you enjoyed it. Go be useless somewhere else.

Thank you, Orange. You took the time to show me what I needed to correct, rather than withholding that knowledge for yourself. You contributed, rather than just making a snarky comment.

fight nice guys.