Search Unity

No appropriate version of 'UnityEngine.Animation.Play' for the argument list '(UnityEngine.Animatio

Discussion in 'Scripting' started by Deleted User, Mar 2, 2015.

  1. Deleted User

    Deleted User

    Guest

    Hello. I am trying to make a script that activates an animation on another object. But I get this error
    Assets/MyAssets/MyScripts/PlayQuitButtons.js(11,23): BCE0023: No appropriate version of 'UnityEngine.Animation.Play' for the argument list '(UnityEngine.AnimationClip)' was found.

    I'm not sure what is going on. I have put animation components on the objects and put my animation on them. Here is the script
    Code (JavaScript):
    1. #pragma strict
    2.  
    3. var sound : AudioClip;
    4. var QuitButton : boolean;
    5. var buttonBob : AnimationClip;
    6.  
    7. function OnMouseEnter()
    8. {
    9.     audio.PlayOneShot(sound);
    10.     animation.Play(buttonBob);
    11.    
    12.  
    13.  
    14. }
    15.  
    16. function OnMouseUp()
    17. {
    18.     if (QuitButton)
    19.     {
    20.  
    21.         Application.Quit();
    22.     }
    23.    
    24.     else
    25.     {
    26.         Application.LoadLevel("Level01");
    27.     }
    28. }

    Any help is greatly appreciated. Thanks!
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675