Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    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.