|
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.
(comments are locked)
|
|
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 e.g.
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. e.g.
Array docs: http://unity3d.com/support/documentation/ScriptReference/Array.html Typical array functions: http://msdn.microsoft.com/en-us/library/system.collections.arraylist_members(VS.80).aspx Thank you ! I have it working now!
Sep 29 '10 at 04:12 PM
richardzzzarnold
(comments are locked)
|

mark correct answers with a tick