Home>

The fbx model has an animated image
I want to perform a "rear up" animation,
I created a script, but when I run it, I get an error if there is no such animation.
Is it a problem of blank space because it can be executed by setting "idle", "run", and "walk"? I wondered if
I get the same error even if I remove the space.

I want to know how to deal with it
Is there a way to specify from an array of animations (element)? I thought soberly.
I can't find anything like that even if I google, so I'll ask you a question.

if (Input.GetKeyDown (KeyCode.S))
{
 aniUni.Play ("idle");
}
if (Input.GetKeyDown (KeyCode.D))
{
 aniUni.Play ("rear up");
}
he animation state could not be played because it couldn't be found!
  • Answer # 1

    It seems that it is not described in the reference Animation, but this class implements IEnumerable and it seems that it is possible to enumerate AnimationState. Therefore...

    foreach (AnimationState animationState in aniUni)
    {
        Debug.Log (animationState.name);
    }

    And so onaniUniI think you can look up the names of all the animations that you have. Also, if you put these names in an array, you can be sureaniUniThe name of the animation thatPlayCould be given as an argument to.

    I'm sorry I haven't been able to identify the cause of the lack of the essential animation. Apparently, the space is not the name that was deleted without permission ... It seems that the name with the space is the name with the space as it is, and as far as I tried, I gave the name of the animation clip as it is When I did it, the animation was played.

    The error message is

    he animation state could not be played because it couldn't be found!

    I'm curious to say that. Originally ...

    The animation state  could not be played because it couldn't be found!
    Please attach an animation clip with the name'' or call this function only for existing animations.

    It seems that, but the part of the animation name that can not be found is blank. Is the code you provided the same as the code when the error actually occurred? If you don't mind, it may be helpful to provide the full script without omitting it.
    Or is it possible that the error is occurring in another script instead of this one? If you have any idea of ​​a script other than this script that is trying to manipulate the animation, it may be the culprit.