Search Unity

Error getting animation info

Discussion in 'Animation' started by xuturk, Dec 13, 2013.

  1. xuturk

    xuturk

    Joined:
    Nov 24, 2013
    Posts:
    7
    Hi.

    I have a 2D animation made by animation window.

    In animator, i create this:

    $mecanim.png

    The animation plays good and i have no problem with this.

    But in other script in the same scene, i want show the GUI when the animation ends (MoveCastle ends).

    The object are this:

    $script.png

    and my code is:

    Code (csharp):
    1. public Animator anim;
    2.  
    3. void OnGUI()
    4.     {
    5. if (anim.animation.isPlaying) {
    6.             print ("SUCCESS!!!");  
    7. }  
    8.         }
    And this not works, i recieve this error:

    How i can access to the animation to control it?

    Im not using avatar or 3d bones because i only animate sprites moving it.

    Thanks!