Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    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. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    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.