Search Unity

Animator.GotoState: State could not be found

Discussion in 'Editor & General Support' started by utku.u, Mar 26, 2014.

  1. utku.u

    utku.u

    Joined:
    Jun 3, 2013
    Posts:
    3
    I animate some 2D UI elements with animation clips that are collected in an animation controller, which is itself connected to an Animator on the root of the UI. The animation states are started with

    Code (csharp):
    1.  
    2. const string ANIMATION_STATE_NAME = "SomeAnimationState";
    3. animator.Play(ANIMATION_STATE_NAME);
    4.  
    About 90% of the time the animations function correctly, but now and then I get:

    and

    Anyone know what could be causing this?
     
  2. sgehrman

    sgehrman

    Joined:
    Aug 21, 2014
    Posts:
    2
    I'm getting the same thing all of a sudden. Anyone Know what's up?
     
  3. StanislavUnity

    StanislavUnity

    Joined:
    Jun 17, 2019
    Posts:
    1
    I get it too. How to fix it?
     
  4. Kadae

    Kadae

    Joined:
    Dec 7, 2013
    Posts:
    52
    The year is 2021. Same.
     
    mattgenesis likes this.
  5. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,909
    You've spelled the name of your animation state incorrectly.
     
  6. TimidBagel

    TimidBagel

    Joined:
    Oct 19, 2020
    Posts:
    1
    I am getting the same problem. all I know is that this only happens when I am trying to animate a canvas.
     
  7. llnt

    llnt

    Joined:
    Feb 27, 2021
    Posts:
    1
    Hi i had this problem and i solved it by finding out and fixing the name in the animator, for me it had a trailing empty space that made it not fit with the name i called from code.