I have a GUI button that triggers an animation. But I want it to trigger animations randomly every time it is pressed. So that the game object which has 10 animations ( spin1,spin2,..)are played randomly each time the trigger is pressed. BUT due to my inexperience I dont really understand arrays. What I have at the moment is simply this
but i have so far changed it to something like this
Thanks for any help.
You need to store the animation list in an array or you can store the name of the animation in a String array, which ever you prefer
You set the size and fill the array with names in the inspector. You return the contents array by typing the name of the array followed by square brackets with a number inside. Remember that arrays start from 0 and not 1.
Typical array functions:
answered Sep 29 '10 at 12:26 PM