Search Unity

Animation is apparently not existing?

Discussion in 'Animation' started by xxlilxjxx, Jul 26, 2014.

  1. xxlilxjxx

    xxlilxjxx

    Joined:
    Jul 21, 2014
    Posts:
    28
    The output says

    There is no animation attached to the "Cube_001" game object, but a script is trying to access it.

    I checked to see if I dragged the animation in, and it is there. I noticed the name was other than the animation name. The new name was "Animator


    This is the entire script.

    function OnMouseDown(){
    animation.Play("anim_ButtonPress");
    }
     
  2. xxlilxjxx

    xxlilxjxx

    Joined:
    Jul 21, 2014
    Posts:
    28
    Bump q-q
     
  3. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    900
    there are two animations systems in unity , animator component maps to the new system. Your code is using the animation field which is mapped to look for the legacy animation component. If you want to use the legacy system you must add an Animation component not an Animator. You will also then have to convert the animation itself to a legacy version. This can be done in the inspector , you need to click the debug button and then change the animation type from a 1 to a 0.