[Solved] NavMesh Pathfinding extension - Change animation name - not working

The NavMesh Pathfinding extension from @davy ‘Change the animation name’ action doesn’t seem to be working. I’ve tested it with the recently updated extension in both 5.2.172 and 5.2.175 with the same results. I haven’t used Change animation name before so can’t comment about previous versions of the extension.

Test project showing different conditions for animation name changing

If I use Destination reached as the condition then the automatic animation changing stops working and it doesn’t do the manual animation change either.

If I use a key press as the condition then the automatic animation changing works. Then when I press the key, it stops working and the manual change doesn’t work either. Before the key press the debugger says the animation name is Walk, which is correct. After the key press, it says the animation name is Sleep. It should be but actually isn’t. It stays on Walk and stops changing to the different directional versions.

If I use the normal Change animation action, it mostly works fine but sometimes glitches and stays on the manually assigned animation when the object is moving. Which is cute, but not what I want.

Does your character has “Sleep0”, “Sleep1”…?

No, it’s just Sleep.
Here is the test project shown in the screenshots above.

I just found out there’s an Animator extension for Top Down movement too so I tried it. The automated animation changes worked perfectly but, with this too, the manual animation name change didn’t work.

Hi @davy, I opened the extension in the editor and tried to find any errors causing the problem but with my limited knowledge, didn’t find anything that made any difference.

But here are some little things I found.

  • There’s an extra space in the fourth action of one of the hidden functions - SetAnimationDirection.

Object. Behavior::PropertyAnimationName() + ToString(Object.Behavior::PropertyAnimationDirection())

  • The ‘Full name displayed in editor’ value of the hidden DirectionDifference function says Direction Dirrerence.

  • Leaving number of directions on zero in the object properties results in a black screen preview with the game not loading as mentioned here and here.
    Update, I guess it’s because the NavMesh Pathfinding behavior doesn’t actually ask in the properties if diagonals are allowed but references it in the Animator events.

Is your extension up to date?

Yes I think so, it’s 0.2.1 I’ve re-installed several times including just now.

Sorry, I missed this part. It was indeed the issue. Thank you for investigating on this.
Please try with the version 0.2.2. It should be released in a couple of hours

I tested it out, it still says 0.2.1 instead of 0.2.2 but it is the new one as the diagonals problem is resolved. But the original problem for me remains. In summary it is this -

With either destination reached or a simple keypress as the condtion - using the navmesh action Change the animation name of object (cat) to ___ (“Sleep”) results in -

The cat will keep going in different pathfinding directions. Let’s say the first direction is walk left (“Walk4”). But for all directions after that, the animation will remain on Walk left. And of course the change animation to Sleep never happens.

It now says 0.2.2 but still has the original problem mentioned above.

Hi @davy, is there any solution for this problem? I tried updating the extension again in 5.2.180. I also tried your TopDown movenent animator extension again and it still has the same problem as the Navmesh pathfinding animator extension:

If I use
Change the animation name of object as an action then the automatic animation directional changes don’t work. It just stays on the first animation.

If I don’t use
Change the animation name of object as an action then the automatic animation directional changes do work.

I tested the extension with a small project and it seems to work fine:
The extension should probably not pause the animation when the character doesn’t move.

I’ve looked at the example and for any future people who have a similar experience to me -

I assumed this meant that I should not name other animations as Sleep0, Sleep1, Sleep2 etc. But it’s actually a requirement that they be named this way. Which is why I got unintended results. But in the events, the animations should be referenced as Sleep (or Walk), without the numbers.

My mistake was to assume that having one Sleep animation would be enough and it would flip left or right depending on what the previous animation was.

So, the extension is more complex than I realised. For it to work as intended, there needs to be 8 matching animations (for 8 direction movement) for any animation that is called to change in the events.

If the current walk is Walk4 then there also needs to be a Sleep4 etc. A simple way of doing this that will be enough for my needs is to have 8 Sleep animations but half with the same left facing image/s and half with the same right facing image/s.

1 Like