Counting on Unity iphone.

Hey I have a healthbar, if the player falls the healthbar changes the texture. How can i specify the number of times he fall?

if(warrior.transform.position.y < 2){  

gameObject.Find ("Health");

//Change the HealthBar

guiTexture.texture = Health2;

}

OK THIS PIECE WORKS FINE BECAUSE IT IS THE FIRST FALL.

HOW CAN I TELL UNITY TO CHANGE TO THE TEXTURE 3 IF HE FALLS A SECOND TIME??

I don't know why being on iPhone would matter, but what you'd do is declare an integer like

var falls = 0;

Then every time you detect that the player has 'fallen' (apparently this means y below 2), you increment that variable

falls++;

But you don't just do that on every frame, you do that only the first time you detect that the player has gone below 2. So you might have another variable

var justAbove = true;

then in your Update function:

if(warrior.transform.position.y < 2){ 
  if (justAbove)
  {
    falls++;
     .... whatever ...
    justAbove = false;
  }
}
else
  justAbove = true;