Bizarre animation behavior after loading scene for the second time

Update : So the animator component is working, I can see the blend tree running, it just looks like even though the speed value is going up and it correct, it for whatever reason is not triggering the transition until I turn the animator component off and then back on in the inspector. I honestly have no idea what would cause this…

Basically to keep this as cohesive as possible. Please dismiss the warnings in the log, they are about trees still having mesh colliders on them and used in terrain.

Click “Play”, everything is working as it should.
Travel through portal and it loads next scene. Everything is behaving as it should.
Travel back through portal to previous scene. Animator on character is completely broken. It is “enabled” in the inspector, but my character slides around without animating. After some fiddling with it, I found that if I “disable” the animator and then “enable” it again, everything is returned to normal operating state. This happens 100% of the time when returning to the first scene loaded. The most bizarre part is that the animator being broken is only on that specific scene, if I travel back to scene 2, it works fine.

Strangely enough, it does appear that your character is in the idle animation… meaning that it believes that forwardSpeed = 0;

When transitioning back to scene 1, select the player in the inspector and look at the parameters. (I would move your animator to a different window than the game, so you can see it in motion). When you move in the game, forwardSpeed should change to match the move speed reported by the NavMeshAgent. If you could video that, so I can take a look at the behavior, that might give a clue.

(this is an odd one, since we’re basically reloading the scene when we move between scenes, meaning that the animator should already be reset by default.

It does show the speed, and even in the animator, it shows it changing to the correct state in the blend tree, however the animation is not updated…

Let’s cough force the issue…

Put this in the Mover.cs in the Start() method (if you don’t have a Start method, add one)

void Start()
{
     GetComponent<Animator>().enabled=false;
     GetComponent<Animator>().enabled=true;
}

This is a kludge, but I can’t think of anything else, or any logical reason it would be doing this.

and unfortunately, that is the first thing I tried, it does not seem to respond to this the same way as manually toggling the state with the inspector.

I have even gone as far as exporting and re-importing things to make sure it was not something else causing the issue, but as barebones as it can be, it is still exhibiting the issue.

A real head-scratcher for sure, but I think I am going to just keep going with the course and deal with this at a later date. It is not exactly game-breaking, just really weird :slight_smile:

Check to make sure there is only one animator on the player.

It’s definitely something you’ll want to get fixed sooner than later, though.

Confirmed, only one animator on the player. The stock animator on the asset prefab I am using was stripped off as well when we first started making blend trees in this course. I just dug through it again though, just to make sure I did not miss one.

While you are not wrong, I also tend to get tunnel vision sometimes on things that aren’t always the most important thing to focus on. I am still very new to everything game development. I appreciate the quick responses and I will keep my eye on it for now and see if there are any other flags that can clue us in to what is going on.

I may not be able to get to it till tomorrow night (it’s about bed time), zip up your project (remove the Library folder) and upload it to https://gdev.tv/projectupload and I’ll take a look at it and see if I can puzzle it out.

Update, I fiddled around with it some more last night (since I can’t ever leave anything alone) :stuck_out_tongue:

Changing the player speed value to 6.1 instead of 6 seems to have fixed it. I am now unable to duplicate the issue. Seems like a really weird thing to be going on, but for now, it appears to be solved. I zoned in and out like 50 times over the course of 10 something play sessions and was no longer able to duplicate the issue.

Thank you again for you time and suggestions!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.