Search Unity

Play the list of animations

Discussion in 'Scripting' started by GizmoBradwell, Oct 5, 2012.

  1. GizmoBradwell

    GizmoBradwell

    Joined:
    Dec 27, 2010
    Posts:
    67
    How do I write a script that SIMPLY just auto plays through all animations contained in the animations Element array when I start the scene? Element 0, 1, 2, 3, 4...

    Something like this?

    Code (csharp):
    1.  
    2.  function Start () {
    3.               animation.PlayQueued("all", QueueMode.PlayNow);      
    4. }
    5.  
     
  2. GizmoBradwell

    GizmoBradwell

    Joined:
    Dec 27, 2010
    Posts:
    67
    No one can hazard a guess?
     
  3. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    You're on the right track with function Start() and PlayQueued(). You should probably use a for loop as well. Here's something of what it would look like:

    Code (csharp):
    1. function Start () {
    2.    for (var state : AnimationState in animation)
    3.       animation.PlayQueued (state.name);
    4. }
     
    Last edited: Oct 5, 2012