Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Help with array of animations.

Discussion in 'Animation' started by dotan19586, Jul 10, 2018.

  1. dotan19586

    dotan19586

    Joined:
    Dec 19, 2016
    Posts:
    1
    Hello all!

    I'm trying to build a step by step guide to a 3d model.
    I want to put a "next" button that plays every next step.
    What I thought is to make an array of animation and with every "next" clicked it plays the next animation.
    I found on the web a nice function that does that:

    Code (CSharp):
    1.     public Animation ReferenceToAnim;
    2.     public AnimationClip[] clips;
    3.     int _currClip = 0;
    4.  
    5.    
    6.     public void OnAnimationComplete()
    7.     {
    8.         _currClip++;
    9.         if (_currClip == clips.Length) return;
    10.         ReferenceToAnim.clip = clips[_currClip];
    11.         ReferenceToAnim.Play();
    12.     }
    When I attach this script to something I need to assign the "ReferenceToAnim" from type Animation, and unity don't let me.

    Can anyone explain the difference between Animation and AnimationClip?
    What kind of animation can I drag to the Animation type?
    With AnimationClip I can drag any animation that I created.

    Thanks!!
    Dotan.