Forum rules - please read before posting.

feature request: a way to know which animatino state is missing

edited October 2014 in Engine development
i have some npc that doesn't have all the animations. but i think i've added a bunch of them but i still get 

Animator.GotoState: State could not be found
UnityEngine.Animator:Play(String, Int32)
AnimEngine_SpritesUnity:PlayStandardAnim(String, Boolean) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:589)
AnimEngine_SpritesUnity:PlayIdle() (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:536)
AC.Char:AnimUpdate() (at Assets/AdventureCreator/Scripts/Character/Char.cs:410)
AC.Char:_FixedUpdate() (at Assets/AdventureCreator/Scripts/Character/Char.cs:242)
AC.NPC:FixedUpdate() (at Assets/AdventureCreator/Scripts/Character/NPC.cs:64)

is there a way to extend this error so i'd know which direction is actually the one missing?

Comments

  • What version are you using?  That's pre-1.39 - please update to the latest when referring to line numbers, 589 doesn't refer to anything in the latest release.
  • edited October 2014
    yeah. 1.38. i thought about waiting for 1.40 before upgrading this project. 
    how soon are you releasing it?
  • edited October 2014
    Unknown.  The more requests made, the longer it takes!
  • The bigger the update the more stuff that can break! :)
  • true. i'm always cautious when upgrading too and prefer to do it as few times as possible because things do tend to break on upgrades some times... 

    considering this ain't urgent. i'll wait :)

  • here are lined from 1.40.

    in this example - I don't have a run animation. when i doubleclick i see this. 

    Animator.GotoState: State could not be found
    UnityEngine.Animator:Play(String, Int32)
    AnimEngine_SpritesUnity:PlayStandardAnim(String, Boolean) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:614)
    AnimEngine_SpritesUnity:PlayRun() (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_SpritesUnity.cs:554)
    AC.Char:AnimUpdate() (at Assets/AdventureCreator/Scripts/Character/Char.cs:483)
    AC.Char:_Update() (at Assets/AdventureCreator/Scripts/Character/Char.cs:255)
    AC.Player:Update() (at Assets/AdventureCreator/Scripts/Character/Player.cs:87)


    but some times it's a talk or i just used a small letter instead or a capital letter when defining the animation...
  • If you look at the line it's referencing (AnimEngine_SpritesUnity.cs, line 614), you can see that the code attempts to display the name of an animation if it fails.  However, Unity doesn't seem to want to play ball.

    This can't be done in the official release, because it would cause too much slowdown to display a log for every animation call, but try this: move the Debug.LogError line (618) up to just above 614 (but within the brackets).  It'll display the name of the animation it's about to play - if it fails immediately after, you'll know which one was the culprit.  Just be sure to move the line back down again once you've found it.
  • I sse what you mean about the function call stack which i have not noticed prior to this. 

    I'll keep this conversation for future reference if i am again puzzled. 

    but my thoughts were that there could maybe be some try-catch method, or some way to query the animator for the existense of a certain animatin before playing , and then display a more user friendly error message / or just a warning?
  • The code's already set up to be a try-catch, but Unity's having none of it.  The method in there now is the only method I know - if you have a solution, I'll happily listen.
  • i actually looked a bit in unity's reference and you're right. nothing seems to point out to a solution. 
    well maybe things will change in 4.6 ot 5.0 :)

  • thanks anyways'

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.