Search Unity

animation state could not be found?

Discussion in 'Animation' started by Sylvar, Sep 23, 2013.

  1. Sylvar

    Sylvar

    Joined:
    Sep 19, 2013
    Posts:
    9
    im trying to call element 1 from my animations via the script that is attached to the game object with said animations but i get this error:
    The animation state Show Could not be played because it couldn't be found!
    Please attach an animation clip with the name 'Show'

    $Untitled.png

    am I doing this wrong? in my script I have no problem callling
    animation.Play("PressedPlay");
    but I cant do
    animation.Play("Show");
     
  2. Archania

    Archania

    Joined:
    Aug 27, 2010
    Posts:
    1,662
    You have the character set to do the legacy rig?
    What is the rest of the script? Do you have it assigned to a button so say the player hits the spacebar which would play the animation?
     
  3. Sylvar

    Sylvar

    Joined:
    Sep 19, 2013
    Posts:
    9
    do i need to set it to legacy rig for a simple transition animation on a gui_texture? I have a playbutton and on mouse down it calls PressedPlay which throws the menu off screen and shows the stage select menu. on the stage select I have a back button that hides the stage select menu and "should" reshow the main menu but thats where my problem is. It "cant find" the animation even though it looks to be correctly attached unless im doing something wrong.

    PlayButton:
    $pb.png

    BackButton:
    $bb.png

    StageSelect:
    $ss.png

    MainMenu:
    $mm.png

    and my scene:
    $scene.png
     
  4. Archania

    Archania

    Joined:
    Aug 27, 2010
    Posts:
    1,662
    You never tell it to goto the function ShowMainMenu. All I see in the PlayButtonScript is a OnMouseButtonDown which will go to the mainMenuScript.PressedPlay().
    These are a lot of scripts to load/switch menus. I'm just saying.
     
  5. Sylvar

    Sylvar

    Joined:
    Sep 19, 2013
    Posts:
    9
    I Know this is really messy, I am quite new to this, but I do call mainMenuScript.ShowMainMenu(); just not in a very straight forward way.
    the way i have it set up is I have an empty game object that contains all the buttons for each UI screen (GUI_MainMenu, GUI_StageSelect) and that game object's script handles all the logic. the buttons just refer to the main scripts so pressing the PlayButton calls mainMenuScript.PressedPlay(); and the back button on for GUI_StageSelect (sry again for mess) calls stageSelectScript.PressedBack() and that function calls mainMenuScript.ShowMainMenu(); I figured that I needed to put the animation.Play("Show"); in the mainMenuScript Since the animation Show is attached to GUI_MainMenu and not the GUI_StageSelect.

    tl;dr
    I know ShowMainMenu(); gets called because the console logs:
    um...
    The animation state Show Could not be played because it couldn't be found!
    Please attach an animation clip with the name 'Show'
    wtf?
     
unityunity