Blend Tree not changing the animation

Hello,
I have the problem that my Blend Tree doesn’t change the animation but the forwardSpeed is set within the script and gets updated.
Video: https://youtu.be/2ptyt8fYJq8
Thank you

This may be an issue with a conflicting Animator. By default, when characters are imported, they have an animator on their root. We drag that character into the Player as a child prefab, putting that unwanted default animator one level below the player as a child. In some cases (no rhyme or reason), that animator can override the one on the player.
Try deleting the animator on the child GameObject.

I removed the Animator on the Knights Soldier
image
The player, the top game object, still has the Animator
image
But unfortunately, it didn’t fix the issue

Post a screenshot of the Animator’s state machine (just above the blend tree)

Do you mean this?

Yes, that looks correct, and I can (barely) see from the video (YouTube has a such a way of blurring things up, doesn’t it?) that the correct forwardSpeed variable is being set, and that the animator logic works…

I may need to take a closer look. I’m sure it’s something simple, but my usual suspects have been eliminated by what we’re seeing.
Zip up your project and upload it to https://gdev.tv/projectupload and I’ll take a look.

Thank you, I uploaded it.
Please don’t worry that nearly everything of the environment is missing (trees, foliage, houses, terrain layers), it was all with third-party textures and models and they made the project over 10 Gigabyte but the animations and character are from the provided resources
And yes, the forwardSpeed is set correctly

Interestingly enough, in your PlayerMovementController script, you had commented out UpdateAnimator in the Update() loop. Uncommenting this line fixed the issue. What I don’t get is that this doesn’t match what I saw in the video, where it appeared that the value was getting updated.

Be mindful of the component names. There is a warning in your project about the Character Controller script, as it conflicts with a built in component name. I would rename this to Mover, since that is the intended function of the script, or if you still want Character in there, CharacterMover. (You’ll have to change the file name, and the name in the class declaration to match, and quite probably replace the component on the player).

I commented it out because I was like “The idle animation is working so I can comment it out I guess” but now that I look at it, it makes sense, Unity has no information about that it needs to play and update the animation - but I agree to you, the UpdateAnimator() contains the set of the forwardSpeed value so how to hell did Unity set that correctly
I didn’t notice that Character Controller is also an built-in component name

Thank you for your time :blush:

Personally, I recommend using our class names for the course project, as this will enable us to troubleshoot issues more easily. You can generally name classes whatever you want (as long as they don’t clash with existing class names, that is). It’s just easier for us to figure out what’s going on in the script if the class names are the ones we use. (For example, I’ll often look at a screenshot of an inspector to see if I can see what’s going on, if the names aren’t corresponding to ours, then I have to ask for more information).

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

Privacy & Terms