Search Unity

Question what tf is an array

Discussion in 'Animation' started by yumarissa, Dec 27, 2022.

  1. yumarissa

    yumarissa

    Joined:
    Dec 16, 2022
    Posts:
    2
    hey guys as you can tell im a raging beginner
    I was following this flappy bird tutorial but couldn't understand how an 'array' can be used to animate
    what is an array
    pls no hate

    Code (CSharp):
    1.     private void AnimateSprite()
    2.     {
    3.         spriteIndex++;
    4.         if (spriteIndex >= sprites.Length)
    5.         {
    6.             spriteIndex = 0;
    7.         }
    8.  
    9.         spriteRenderer.sprite = sprites[spriteIndex];
    10.  
    11.     }
    also what's sprites.Length

    thank you so much
     
    Last edited: Dec 27, 2022
  2. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    618
  3. yumarissa

    yumarissa

    Joined:
    Dec 16, 2022
    Posts:
    2