Forum rules - please read before posting.

Issue on character animate action

Hi everybody,
AC 1.75.2 and Unity LTS 2021.3.0f1 in 2d.

We have a issue on character animate action.
Here the passages:

  • we have a 2d character (sprites unity)
  • he has to reach a hotspot: we have a marker with -50° (so UR direction). In the Use action of the hotspot the player has to "Walk to Marker" and "face after moving" (checked).
  • The hotspot is in a right upper corner so when the character reaches it we put an action list to look up. In particular we have a "action list: run" to call an action list asset where there are two actions: the first one is "Character: Animate" and call a play custom animation "Talk look up" with suffix (it's a "standard" animation with all directions), "wait until finish" and "return to idle after" checked. The second one is "Character: Animate" set standard talk to Talk_Look_Up.

Our character locks on the first action "Character: animate" play custom animation "Talk look up".

Debugging the code we noticed that "Character: Animate" calls the function ActionCharAnimRun (line 283 of AnimEngine_SpriteUnity). The first time it is called, the function character.GetSpriteDirection() at line 288 returns "U", so AC plays the clip oriented to the up direction. Then, the second time this function is called, GetSpriteDirection returns "UR". Thereafter the action is stucked in a loop since at line 419 there is this check : "GetCurrentAnimatorStateInfo (action.layerInt).shortNameHash != Animator.StringToHash (clip2DNew)" and the action returns waiting the defaultPauseTime.
It looks like the character animate starts before the turning of the character is completed.

Is there a way to solve it?

Thank you very much.

Comments

  • Thanks for the report.

    It looks like this is a case of 2 bugs at once - I can fix the issue with the animation Hash comparison, but it sounds like the sprite direction returning "U" in the first frame is a separate issue.

    Does the issue persist if you precede the Actions with an "Engine: Wait" of -1s?

  • Hello Chris and thank you. With an "Engine: Wait" of -1s before othe actions the issue seems solved. Thank you.

  • Hi Chris, we tried the workaround but in some cases it doesn't work. We noticed that in these cases we need to add more Engine:Wait -1 blocks. This issue is quite dangerous so we would like to know if you scheduled a fix for it.
    Thank you.

  • A fix for the first of the two issues - with the hash being incorrectly compared - will be included in the next release.

    If you're looking to apply it beforehand, replace:

    public override float ActionCharAnimRun (ActionCharAnim action)
    {
        string clip2DNew = action.clip2D;
        if (action.includeDirection)
        {
            clip2DNew += character.GetSpriteDirection ();
        }
    
        if (!action.isRunning)
        {
            action.isRunning = true;
    

    with:

    string clip2DNew;
    public override float ActionCharAnimRun (ActionCharAnim action)
    {
        if (!action.isRunning)
        {
            clip2DNew = action.clip2D;
            if (action.includeDirection)
            {
                clip2DNew += character.GetSpriteDirection ();
            }
    
            action.isRunning = true;
    

    I suspect that this will still cause the "Up" animation to play, however. I will need additional details in order to recreate the issue of the wrong direction being played. For a start, please share your Settings Manager and Player's full Inspector.

  • Hello Chris,
    thank you very much. With the changes you suggested game doesn't lock, but the direction of animation is not correct (as you supposed). Here the settings and player screenshots:

    Settings Manager: https://drive.google.com/file/d/1EGtmuvnB6MZN_702G6QdyeMDeJq4UwId/view?usp=sharing

    Player01: https://drive.google.com/file/d/1-GXtS-wdXhz68so1M9WoCHUtY0iAD_S7/view?usp=sharing

    Player02: https://drive.google.com/file/d/1WBNV8b77SAT8wh2Vxxkh-Kx6W36--eSX/view?usp=sharing

    Please tell me if you can give you more info to help to reproduce it.

    Thank you very much.

  • Thanks for the screens. Is there any difference if you:

    • Remove the Rigidbody2D component
    • Uncheck "Retro-style movement?"
    • Uncheck "Turn root object in 3D?"

    Either together or individually?

    Let's also see the manner in which your moving/turning the Player, i.e. the Hotspot Inspector / ActionList involved.

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.